Input dialog was in top left of screen, set it to center

This commit is contained in:
Grégory Soutadé 2012-04-27 21:38:30 +02:00
parent 2e468c14b4
commit 691b1a603b
2 changed files with 9 additions and 8 deletions

View File

@ -584,7 +584,7 @@ void PreferencesPanel::OnAccountDeleteClicked(int id)
QString res;
QCheckBox* checkBox = qobject_cast<QCheckBox*> (_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<QCheckBox*> (_defaultSignalMapper.mapping(id));
checkBox = qobject_cast<QCheckBox*> (_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;

View File

@ -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())
{