From 691b1a603b4f01b810bc7eddf661a12cd318744d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 27 Apr 2012 21:38:30 +0200 Subject: [PATCH] Input dialog was in top left of screen, set it to center --- src/view/PreferencesPanel.cpp | 13 +++++++------ src/view/SearchPanel.cpp | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index 299d26e..d578745 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -584,7 +584,7 @@ void PreferencesPanel::OnAccountDeleteClicked(int id) QString res; QCheckBox* checkBox = qobject_cast (_deleteAccountSignalMapper.mapping(id)); Account account; - bool ok; + bool ok, default_account; if (user->GetAccountsNumber() == 1) { @@ -609,7 +609,7 @@ void PreferencesPanel::OnAccountDeleteClicked(int id) if (user->_accounts[i].id != id) accounts << user->_accounts[i].name; - res = QInputDialog::getItem(this, "KissCount", _("Wich account will replace this one ?"), accounts, 0, false, &ok); + res = QInputDialog::getItem(NULL, "KissCount", _("Wich account will replace this one ?"), accounts, 0, false, &ok); if (!ok) { @@ -620,15 +620,16 @@ void PreferencesPanel::OnAccountDeleteClicked(int id) else { i = accounts.indexOf(res); + default_account = user->_accounts[i]._default; _kiss->DeleteAccount(account, (!i) ? 0 : user->GetAccountId(accounts[i])); _accountsGrid->removeRow(row); } - if (user->_accounts.size() == 1) + if (default_account) { user->_accounts[0]._default = true; _kiss->UpdateAccount(user->_accounts[0]); - checkBox = qobject_cast (_defaultSignalMapper.mapping(id)); + checkBox = qobject_cast (_accountsGrid->cellWidget(0, ACCOUNT_DEFAULT)); checkBox->setCheckState(Qt::Checked); } @@ -685,7 +686,7 @@ void PreferencesPanel::OnCategoryDeleteClicked(int id) if (user->_categories[i].id != id) categories << _(user->_categories[i].name.toStdString().c_str()); - res = QInputDialog::getItem(this, "KissCount", _("Wich category will replace this one ?"), categories, 0, false, &ok); + res = QInputDialog::getItem(NULL, "KissCount", _("Wich category will replace this one ?"), categories, 0, false, &ok); if (!ok) { @@ -867,8 +868,8 @@ void PreferencesPanel::OnAccountModified(int row, int col) new_account._virtual = false; new_account.hidden = false; - AddAccount(row, new_account); _kiss->AddAccount(new_account); + AddAccount(row, new_account); new_account.id = 0; diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 59da582..557a878 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -141,7 +141,7 @@ void SearchPanel::OnButtonChangeAccount() for(i=0; i < user->GetAccountsNumber(); i++) accounts << user->_accounts[i].name; - res = QInputDialog::getItem(this, "KissCount", _("Choose a new account"), accounts, 0, false); + res = QInputDialog::getItem(NULL, "KissCount", _("Choose a new account"), accounts, 0, false); if (!res.size()) return ; a = (res.length()) ? accounts.indexOf(res) : 0; @@ -181,7 +181,7 @@ void SearchPanel::OnButtonChangeCategory() for(i=0; i < user->GetCategoriesNumber(); i++) categories << _(user->_categories[i].name.toStdString().c_str()); - res = QInputDialog::getItem(this, "KissCount", _("Choose a new category"), categories, 0, false); + res = QInputDialog::getItem(NULL, "KissCount", _("Choose a new category"), categories, 0, false); if (res.length()) {