added save account button and account removal warning

This commit is contained in:
Rinaldus 2016-02-08 21:26:43 +03:00
parent 8518e9f93d
commit 6a1dba2aae
6 changed files with 2686 additions and 2554 deletions

BIN
icons/save_account.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -71,6 +71,7 @@ class Window(QDialog):
self.ui.comboAccounts.currentTextChanged.connect(self.comboAccounts_changed)
self.ui.btnAddAccount.clicked.connect(self.btnAddAccount_clicked)
self.ui.btnRenameAccount.clicked.connect(self.btnRenameAccount_clicked)
self.ui.btnSaveAccount.clicked.connect(self.btnSaveAccount_clicked)
self.ui.btnRemoveAccount.clicked.connect(self.btnRemoveAccount_clicked)
# Main timer
@ -174,13 +175,20 @@ class Window(QDialog):
self.ui.comboAccounts.setCurrentText(GroupName[0])
self.SettingsRemove(OldGroupName)
def btnSaveAccount_clicked(self):
self.SettingsSave(self.ui.comboAccounts.currentText())
self.ui.lblTestOutput.setText("Acount saved")
def btnRemoveAccount_clicked(self):
reply = QMessageBox.critical(self, 'Warning!', "Delete this account permanently?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if (reply == QMessageBox.Yes):
Index = self.ui.comboAccounts.currentIndex()
GroupName = self.ui.comboAccounts.currentText()
self.ui.comboAccounts.removeItem(Index)
self.SettingsRemove(GroupName)
def comboAccounts_changed(self):
self.ui.lblTestOutput.setText("")
settings.beginGroup(self.ui.comboAccounts.currentText())
self.ui.txtboxMailServer.setText(settings.value("MailServer"))
self.ui.txtboxPort.setText(settings.value("Port"))
@ -298,5 +306,3 @@ if __name__ == '__main__':
sys.exit(app.exec_())
# TODO:
# Separate mail count for each account
# New save account button
# Account removal warning dialog

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/save_account.png</file>
<file>icons/mailbox_empty.png</file>
<file>icons/mailbox_full.png</file>
<file>icons/mailbox_error.png</file>

File diff suppressed because it is too large Load Diff

View File

@ -364,7 +364,7 @@
<widget class="QPushButton" name="btnRemoveAccount">
<property name="geometry">
<rect>
<x>260</x>
<x>300</x>
<y>80</y>
<width>31</width>
<height>23</height>
@ -382,6 +382,27 @@
</iconset>
</property>
</widget>
<widget class="QPushButton" name="btnSaveAccount">
<property name="geometry">
<rect>
<x>260</x>
<y>80</y>
<width>31</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string>Save account</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/save_account.png</normalon>
</iconset>
</property>
</widget>
</widget>
<resources>
<include location="../resources.qrc"/>

View File

@ -131,12 +131,19 @@ class Ui_Settings(object):
self.btnRenameAccount.setIcon(icon2)
self.btnRenameAccount.setObjectName("btnRenameAccount")
self.btnRemoveAccount = QtWidgets.QPushButton(Settings)
self.btnRemoveAccount.setGeometry(QtCore.QRect(260, 80, 31, 23))
self.btnRemoveAccount.setGeometry(QtCore.QRect(300, 80, 31, 23))
self.btnRemoveAccount.setText("")
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(":/icons/remove_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnRemoveAccount.setIcon(icon3)
self.btnRemoveAccount.setObjectName("btnRemoveAccount")
self.btnSaveAccount = QtWidgets.QPushButton(Settings)
self.btnSaveAccount.setGeometry(QtCore.QRect(260, 80, 31, 23))
self.btnSaveAccount.setText("")
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(":/icons/save_account.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
self.btnSaveAccount.setIcon(icon4)
self.btnSaveAccount.setObjectName("btnSaveAccount")
self.retranslateUi(Settings)
self.buttonBox.accepted.connect(Settings.accept)
@ -162,5 +169,6 @@ class Ui_Settings(object):
self.btnAddAccount.setToolTip(_translate("Settings", "Add account"))
self.btnRenameAccount.setToolTip(_translate("Settings", "Rename account"))
self.btnRemoveAccount.setToolTip(_translate("Settings", "Remove account"))
self.btnSaveAccount.setToolTip(_translate("Settings", "Save account"))
import resources_rc