def fav(self): bookmarks = self.dbConnection.executewithreturn("""SELECT * FROM bookmarks""") find = False for i in bookmarks: if i[2] == self.browserWidget.url().toString(): self.dbConnection.executewithoutreturn("""DELETE FROM bookmarks WHERE id = ?""", (i[0],)) self.bookmark.setIcon(QIcon("Icons/NavigationBar/noFav.png")) find = True if not find: self.dbConnection.executewithoutreturn("""INSERT INTO bookmarks(name, url, date) VALUES(?, ?, ?)""", ( self.browserWidget.title(), self.browserWidget.url().toString(), getdate())) self.bookmark.setIcon(QIcon("Icons/NavigationBar/yesFav.png")) self.parameterWindow.bookmarksPage.showupdate()
def addraccourci(self): raccourcis = self.parent.parent.dbConnection.executewithreturn("""SELECT * FROM raccourcis""") for i in raccourcis: if i[1] == self.tEntry.text(): QMessageBox.warning(self, "Erreur", "Ce raccourcis existe déjà.") return tentrybool = self.tEntry.text() != "" and self.tEntry.text() != self.tEntryString uentrybool = self.uEntry.text() != "" and self.uEntry.text() != self.uEntryString if tentrybool and uentrybool: self.parent.parent.dbConnection.executewithoutreturn( """INSERT INTO raccourcis(name, url, date) VALUES(?, ?, ?)""", (self.tEntry.text(), self.uEntry.text(), getdate()) ) self.showupdate()
def addfavf(self): bookmarks = self.parent.parent.dbConnection.executewithreturn( """SELECT * FROM bookmarks""") for i in bookmarks: bool1 = i[1] == self.parent.parent.browserWidget.title() bool2 = i[2] == self.parent.parent.browserWidget.url().toString() if bool1 and bool2: QMessageBox.warning(self, "Erreur", "Cette page est déjà en favori.") return self.parent.parent.dbConnection.executewithoutreturn( """INSERT INTO bookmarks(name, url, date) VALUES(?, ?, ?)""", (self.parent.parent.browserWidget.title(), self.parent.parent.browserWidget.url().toString(), getdate())) self.parent.parent.bookmark.setIcon( QIcon("Icons/NavigationBar/yesFav.png")) self.showupdate()
def addsession(self): sessions = self.parent.parent.dbConnection.executewithreturn( """SELECT * FROM sessions""") for i in sessions: if i[1] == self.tEntry.text(): QMessageBox.warning(self, "Erreur", "Cette session existe déjà.") return tentrybool = self.tEntry.text() != "" and self.tEntry.text( ) != self.tEntryString if tentrybool: urls = "" for i in range(self.parent.parent.tabWidget.count()): urls += self.parent.parent.tabWidget.widget( i).url().toString() + " | " self.parent.parent.dbConnection.executewithoutreturn( """INSERT INTO sessions(name, urls, date) VALUES(?, ?, ?)""", (self.tEntry.text(), urls[:-3], getdate())) self.showupdate()
def addhistory(self): self.dbConnection.executewithoutreturn("""INSERT INTO history(name, url, date) VALUES(?, ?, ?)""", ( self.browserWidget.title(), self.browserWidget.url().toString(), getdate()))