def __init__(self, addressbook=None, addressbookimages=None, work_dir=None):
        QtGui.QMainWindow.__init__(self)

        self.name = "contactsGUI"
        
        if work_dir is not None:
            self.work_dir = work_dir
        else:
            self.work_dir = makeTmpDir()

        self.ui = Ui_frmContacts()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        QtCore.QObject.connect(self.ui.treeWidgetContacts, QtCore.SIGNAL("itemSelectionChanged()"), self.onTreeClick)
        QtCore.QObject.connect(self.ui.actionReport, QtCore.SIGNAL("triggered(bool)"), self.printReport)
        QtCore.QObject.connect(self.ui.actionExtract, QtCore.SIGNAL("triggered(bool)"), self.extractApp)

        self.ui.treeWidgetContacts.setHeaderLabel('Contacts')
        self.ui.treeWidgetContacts.setColumnHidden(1, False)
        self.ui.treeWidgetContacts.setColumnHidden(2, False)
        self.ui.treeWidgetContacts.setColumnHidden(3, False)
        self.ui.treeWidgetContacts.setColumnHidden(4, False)
        self.ui.treeWidgetContacts.setColumnHidden(5, False)
        self.ui.treeWidgetContacts.setColumnHidden(6, False)
        self.ui.treeWidgetContacts.setColumnHidden(7, False)
        self.ui.treeWidgetContacts.setColumnHidden(8, False)
        self.ui.treeWidgetContacts.setColumnHidden(9, False)

        self.address_book_list = get_addressbook(addressbook, addressbookimages)
        for contact in self.address_book_list:
            name = ""
            if contact.last_name != "" and contact.last_name is not None:
                name = contact.last_name
            if contact.first_name != "" and contact.first_name is not None:
                if name is not "":
                    name = name + ", " + contact.first_name
                else:
                    name = contact.first_name
            if name == "":
                name = contact.organization

            newItem = QtGui.QTreeWidgetItem(None)
            newItem.setText(0, name)
            newItem.setText(1, contact.rowid)
            newItem.setText(2, contact.last_name)
            newItem.setText(3, contact.first_name)
            newItem.setText(4, contact.organization)
            newItem.setText(5, str(contact.creation_date))
            newItem.setText(6, str(contact.modification_date))
            newItem.setText(7, str(contact.birthday))
            newItem.setText(8, contact.image_url)
            newItem.setText(9, str(contact.multivalue))
            self.ui.treeWidgetContacts.addTopLevelItem(newItem)
Esempio n. 2
0
    def __init__(self):
        super(iOSBE, self).__init__(None)

        self.backuppath = None
        self.database = None
        self.cursor = None
        self.manifest = None
        self.infoplist = None
        self.iOSVersion = 0
        self.passwd = None
        self.work_dir = None
        self.extractpath = None
        self.is_active = False
        self.mbdb = None
        self.mru_list = list()
        self.threemaUI = None
        self.contactsUI = None
        self.sqlbrowserUI = None
        self.smsUI = None
        self.callhistoryUI = None
        self.whatsappUI = None

        if "linux" in sys.platform:
            self.mousewait = Qt.WaitCursor
        else:
            self.mousewait = QCursor(Qt.WaitCursor)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.ui.treeViewDomains.setContextMenuPolicy(Qt.CustomContextMenu)
        self.ui.treeViewDomains.customContextMenuRequested.connect(self.ctxMenu)

        self.ui.treeViewDomains.setHeaderLabel("")

        self.ui.treeViewDomains.setColumnWidth(0, 200)
        self.ui.treeViewDomains.setColumnWidth(2, 16)

        self.ui.treeViewDomains.setColumnHidden(1, True)
        self.ui.treeViewDomains.setColumnHidden(3, True)
        self.ui.treeViewDomains.setColumnHidden(4, True)
        self.ui.treeViewDomains.setColumnHidden(5, True)

        # action handlers
        QtCore.QObject.connect(self.ui.action_OpenBackup, QtCore.SIGNAL("triggered(bool)"), self.openBackupGUI)
        QtCore.QObject.connect(self.ui.action_About, QtCore.SIGNAL("triggered(bool)"), self.displayAbout)
        QtCore.QObject.connect(self.ui.action_CloseBackup, QtCore.SIGNAL("triggered(bool)"), self.closeBackup)

        QtCore.QObject.connect(self.ui.action_ExtractApp, QtCore.SIGNAL("triggered(bool)"), self.extractApp)
        QtCore.QObject.connect(self.ui.action_ExtractAll, QtCore.SIGNAL("triggered(bool)"), self.extractAll)

        QtCore.QObject.connect(self.ui.action_Contacts, QtCore.SIGNAL("triggered(bool)"), self.showContacts)
        QtCore.QObject.connect(self.ui.action_CallHistory, QtCore.SIGNAL("triggered(bool)"), self.showCallHistory)
        QtCore.QObject.connect(self.ui.action_Messages, QtCore.SIGNAL("triggered(bool)"), self.showMessages)
        QtCore.QObject.connect(self.ui.action_Threema, QtCore.SIGNAL("triggered(bool)"), self.showThreema)
        QtCore.QObject.connect(self.ui.action_WhatsApp, QtCore.SIGNAL("triggered(bool)"), self.showWhatsapp)

        self.work_dir = makeTmpDir()

        if sys.platform != "darwin":
            self.ui.separatorMRUList.setSeparator(True)
            self.mruLoadList()
            self.mruUpdateFileMenu()