diff options
| author | 2023-10-10 17:58:14 +0200 | |
|---|---|---|
| committer | 2023-10-18 10:26:35 +0200 | |
| commit | 9052018b53ece6c073b57c89665ae693a3f0fb97 (patch) | |
| tree | 24dd1cba8974439f646a242bc0cb228076fa38b2 /src | |
| parent | Address feedback for XmlFunctions.cpp (diff) | |
| download | KVIrc-9052018b53ece6c073b57c89665ae693a3f0fb97.tar.gz KVIrc-9052018b53ece6c073b57c89665ae693a3f0fb97.tar.bz2 KVIrc-9052018b53ece6c073b57c89665ae693a3f0fb97.zip | |
Migrate almost all QMessagebox to qt6-friendly version.
Diffstat (limited to 'src')
28 files changed, 193 insertions, 216 deletions
diff --git a/src/kvirc/kernel/KviDefaultScript.cpp b/src/kvirc/kernel/KviDefaultScript.cpp index c4c010319..f8ffe8186 100644 --- a/src/kvirc/kernel/KviDefaultScript.cpp +++ b/src/kvirc/kernel/KviDefaultScript.cpp @@ -118,13 +118,13 @@ void KviDefaultScriptManager::restore() // Check data if(!compareVersions(szGlobal, &szError)) { - QMessageBox::warning(nullptr, __tr2qs("Restore Default - KVIrc"), szError, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::warning(nullptr, __tr2qs("Restore Default - KVIrc"), szError); return; } if(m_bNoNeedToRestore) { - if(QMessageBox::warning(nullptr, __tr2qs("Restore Default - KVIrc"), szError, QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes) + if(QMessageBox::question(nullptr, __tr2qs("Restore Default - KVIrc"), szError) != QMessageBox::Yes) return; } diff --git a/src/kvirc/kernel/KviMain.cpp b/src/kvirc/kernel/KviMain.cpp index 99ee5708c..53376a62a 100644 --- a/src/kvirc/kernel/KviMain.cpp +++ b/src/kvirc/kernel/KviMain.cpp @@ -431,7 +431,7 @@ int main(int argc, char ** argv) KviCString szTmp(KviCString::Format, "Another KVIrc session is already running on this display and with this user ID.\nUse %s -f if you want to force a new session.", argv[0]); if(a.bShowPopup) { - QMessageBox::information(nullptr, "Duplicate Session - KVIrc", szTmp.ptr(), QMessageBox::Ok); + QMessageBox::information(nullptr, "Duplicate Session - KVIrc", szTmp.ptr()); } else { diff --git a/src/kvirc/ui/KviFileDialog.cpp b/src/kvirc/ui/KviFileDialog.cpp index e20180119..b93851ca0 100644 --- a/src/kvirc/ui/KviFileDialog.cpp +++ b/src/kvirc/ui/KviFileDialog.cpp @@ -115,7 +115,7 @@ bool KviFileDialog::askForSaveFileName(QString & szBuffer, const QString & szCap QString szTmp = QString(__tr2qs("The file %1 already exists.<br>Do you wish to overwrite it?")).arg(szBuffer); - switch(QMessageBox::information(pParent, __tr2qs("File Already Exists - KVIrc"), szTmp, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape)) + switch(QMessageBox::question(pParent, __tr2qs("File Already Exists - KVIrc"), szTmp, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel)) { case QMessageBox::Cancel: return false; @@ -156,7 +156,7 @@ bool KviFileDialog::askForSaveFileName(QString & szBuffer, const QString & szCap { QString szTmp = QString(__tr2qs("The file %1 already exists.<br>Do you wish to overwrite it?")).arg(szBuffer); - switch(QMessageBox::information(pDialog, __tr2qs("File Already Exists - KVIrc"), szTmp, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape)) + switch(QMessageBox::question(pDialog, __tr2qs("File Already Exists - KVIrc"), szTmp, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel)) { case QMessageBox::Cancel: delete pDialog; diff --git a/src/kvirc/ui/KviIrcView.cpp b/src/kvirc/ui/KviIrcView.cpp index 79f04fef1..6dba743d5 100644 --- a/src/kvirc/ui/KviIrcView.cpp +++ b/src/kvirc/ui/KviIrcView.cpp @@ -2270,7 +2270,7 @@ void KviIrcView::chooseBackground() QPixmap p(f); if(p.isNull()) { - QMessageBox::information(this, __tr2qs("Invalid Image - KVIrc"), __tr2qs("Failed to load the selected image!"), __tr2qs("OK")); + QMessageBox::information(this, __tr2qs("Invalid Image - KVIrc"), __tr2qs("Failed to load the selected image!")); return; } diff --git a/src/kvirc/ui/KviMainWindow.cpp b/src/kvirc/ui/KviMainWindow.cpp index 10bbbd066..9b6ba35b8 100644 --- a/src/kvirc/ui/KviMainWindow.cpp +++ b/src/kvirc/ui/KviMainWindow.cpp @@ -826,21 +826,24 @@ void KviMainWindow::closeEvent(QCloseEvent * e) if(bGotRunningConnection) { - QString txt = __tr2qs("There are active connections, are you sure you wish to quit KVIrc?"); - - switch(QMessageBox::warning(this, __tr2qs("Confirm Close - KVIrc"), txt, __tr2qs("&Yes"), __tr2qs("&Always"), __tr2qs("&No"), 2, 2)) + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs("Confirm Close - KVIrc")); + pMsgBox.setText(__tr2qs("There are active connections, are you sure you wish to quit KVIrc?")); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs("&Yes"), QMessageBox::YesRole); + QAbstractButton * pAlwaysButton = pMsgBox.addButton(__tr2qs("&Always"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton(__tr2qs("&No"), QMessageBox::NoRole); + pMsgBox.setDefaultButton(qobject_cast<QPushButton *>(pNoButton)); + pMsgBox.exec(); + if(pMsgBox.clickedButton() == pYesButton) { - case 0: - // ok to close - break; - case 1: - // ok to close but don't ask again - KVI_OPTION_BOOL(KviOption_boolConfirmCloseWhenThereAreConnections) = false; - break; - case 2: - e->ignore(); - return; - break; + // ok to close + } else if(pMsgBox.clickedButton() == pAlwaysButton) { + // ok to close but don't ask again + KVI_OPTION_BOOL(KviOption_boolConfirmCloseWhenThereAreConnections) = false; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + e->ignore(); + return; } } } diff --git a/src/kvirc/ui/KviMessageBox.cpp b/src/kvirc/ui/KviMessageBox.cpp index 3fa54bce5..26c058ec7 100644 --- a/src/kvirc/ui/KviMessageBox.cpp +++ b/src/kvirc/ui/KviMessageBox.cpp @@ -79,9 +79,7 @@ namespace KviMessageBox KStandardGuiItem::cont(), KStandardGuiItem::stop()) == KMessageBox::PrimaryAction); #else - bRet = (QMessageBox::information(0, caption, s, - QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape) + bRet = (QMessageBox::question(0, caption, s) == QMessageBox::Yes); #endif return bRet; diff --git a/src/modules/actioneditor/ActionEditor.cpp b/src/modules/actioneditor/ActionEditor.cpp index d90d4fb35..3a7b10a13 100644 --- a/src/modules/actioneditor/ActionEditor.cpp +++ b/src/modules/actioneditor/ActionEditor.cpp @@ -744,7 +744,7 @@ void ActionEditor::exportActions() if(!KviFileUtils::writeFile(szFile, szCode)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the actions file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the actions file.", "editor")); } } @@ -762,7 +762,7 @@ void ActionEditor::deleteActions() if(l.isEmpty()) return; - //if(QMessageBox::question(this,__tr2qs_ctx("Confirm Actions Deletion - KVIrc","editor"),__tr2qs_ctx("Do you really want to delete the selected actions?","editor"),__tr2qs_ctx("Yes","editor"),__tr2qs_ctx("No","editor")) != 0) + //if(QMessageBox::question(this,__tr2qs_ctx("Confirm Actions Deletion - KVIrc","editor"),__tr2qs_ctx("Do you really want to delete the selected actions?","editor")) != QMessageBox::Yes) // return; for(ActionEditorTreeWidgetItem * i = l.first(); i; i = l.next()) diff --git a/src/modules/addon/AddonManagementDialog.cpp b/src/modules/addon/AddonManagementDialog.cpp index df08b9368..1e2316c7e 100644 --- a/src/modules/addon/AddonManagementDialog.cpp +++ b/src/modules/addon/AddonManagementDialog.cpp @@ -280,8 +280,8 @@ void AddonManagementDialog::uninstallScript() if(QMessageBox::question( this, __tr2qs_ctx("Confirm Addon Uninstallation - KVIrc", "addon"), - txt, __tr2qs_ctx("Yes", "addon"), __tr2qs_ctx("No", "addon"), nullptr, 1) - != 0) + txt) + != QMessageBox::Yes) return; KviKvsScriptAddonManager::instance()->unregisterAddon(it->addon()->name(), g_pActiveWindow); @@ -322,10 +322,7 @@ void AddonManagementDialog::installScript() QMessageBox::critical( this, __tr2qs_ctx("Install Addon - KVIrc", "addon"), - szError, - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton); + szError); return; } } @@ -337,10 +334,7 @@ void AddonManagementDialog::installScript() QMessageBox::critical( this, __tr2qs_ctx("Install Addon - KVIrc", "addon"), - szError, - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton); + szError); } fillListView(); diff --git a/src/modules/addon/PackAddonDialog.cpp b/src/modules/addon/PackAddonDialog.cpp index 6bb8c7099..4b86e1fd9 100644 --- a/src/modules/addon/PackAddonDialog.cpp +++ b/src/modules/addon/PackAddonDialog.cpp @@ -156,9 +156,7 @@ bool PackAddonDialog::packAddon() if(QMessageBox::question( this, __tr2qs_ctx("Exporting Addon Confirmation - KVIrc", "addon"), - __tr2qs_ctx("File %1 already exists. Do you want to overwrite it?", "addon").arg(info.szSavePath), - QMessageBox::Yes, - QMessageBox::No) + __tr2qs_ctx("File %1 already exists. Do you want to overwrite it?", "addon").arg(info.szSavePath)) == QMessageBox::No) return false; } @@ -177,12 +175,11 @@ bool PackAddonDialog::packAddon() if(!AddonFunctions::pack(info, szError)) { QMessageBox::critical(this, - __tr2qs_ctx("Addon Packaging - KVIrc", "addon"), - szError, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + __tr2qs_ctx("Addon Packaging - KVIrc", "addon"), szError); return false; } - QMessageBox::information(this, __tr2qs_ctx("Exporting Addon Completed - KVIrc", "addon"), __tr2qs_ctx("The package was saved successfully in %1", "addon").arg(info.szSavePath), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::information(this, __tr2qs_ctx("Exporting Addon Completed - KVIrc", "addon"), __tr2qs_ctx("The package was saved successfully in %1", "addon").arg(info.szSavePath)); return true; } diff --git a/src/modules/aliaseditor/AliasEditorWindow.cpp b/src/modules/aliaseditor/AliasEditorWindow.cpp index 1d2cc8d02..93ae61764 100644 --- a/src/modules/aliaseditor/AliasEditorWindow.cpp +++ b/src/modules/aliaseditor/AliasEditorWindow.cpp @@ -336,9 +336,8 @@ void AliasEditorWidget::aliasRefresh(const QString & szName) return; } if( - QMessageBox::warning(nullptr, __tr2qs_ctx("Confirm Overwriting Current - KVIrc", "editor"), - __tr2qs_ctx("An external script has changed the alias you are currently editing. Do you want to accept the external changes?", "editor"), - QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) + QMessageBox::question(nullptr, __tr2qs_ctx("Confirm Overwriting Current - KVIrc", "editor"), + __tr2qs_ctx("An external script has changed the alias you are currently editing. Do you want to accept the external changes?", "editor")) != QMessageBox::Yes) return; item->setBuffer(alias->code()); @@ -465,8 +464,7 @@ void AliasEditorWidget::renameItem() g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This name is already in use. Please choose another one.", "editor")); g_pAliasEditorModule->unlock(); return; } @@ -479,8 +477,7 @@ void AliasEditorWidget::renameItem() g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This name is already in use. Please choose another one.", "editor")); g_pAliasEditorModule->unlock(); return; } @@ -749,7 +746,7 @@ void AliasEditorWidget::exportSelectionInSinglesFiles(KviPointerList<AliasEditor if(!l->first()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("Must select an entry from the list to export!", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("Must select an entry from the list to export!", "editor")); g_pAliasEditorModule->unlock(); return; } @@ -783,14 +780,23 @@ void AliasEditorWidget::exportSelectionInSinglesFiles(KviPointerList<AliasEditor QString szCompletePath = m_szDir + szFileName; if(KviFileUtils::fileExists(szCompletePath) && !bReplaceAll) { - QString szMsg; - szMsg = QString(__tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?", "editor")).arg(szFileName); - int ret = QMessageBox::question(this, __tr2qs_ctx("Confirm Replacing File - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor")); - if(ret != 2) + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs_ctx("Confirm Replacing File - KVIrc", "editor")); + pMsgBox.setText(QString(__tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?", "editor")).arg(szFileName)); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs_ctx("Yes", "editor"), QMessageBox::YesRole); + QAbstractButton * pAlwaysButton = pMsgBox.addButton(__tr2qs_ctx("Yes to All", "editor"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton( __tr2qs_ctx("No", "editor"), QMessageBox::NoRole); + pMsgBox.setDefaultButton(qobject_cast<QPushButton *>(pNoButton)); + pMsgBox.exec(); + if(pMsgBox.clickedButton() == pYesButton) { KviFileUtils::writeFile(szCompletePath, tmp); - if(ret == 1) - bReplaceAll = true; + } else if(pMsgBox.clickedButton() == pAlwaysButton) { + KviFileUtils::writeFile(szCompletePath, tmp); + bReplaceAll = true; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + // nothing } } else @@ -832,7 +838,7 @@ void AliasEditorWidget::exportAliases(bool bSelectedOnly, bool bSingleFiles) if(szOut.isEmpty()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("The exported file could be empty: cowardly refusing to write it.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("The exported file could be empty: cowardly refusing to write it.", "editor")); g_pAliasEditorModule->unlock(); return; } @@ -874,7 +880,7 @@ void AliasEditorWidget::exportAliases(bool bSelectedOnly, bool bSingleFiles) if(!KviFileUtils::writeFile(szFile, szOut)) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the aliases file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the aliases file.", "editor")); g_pAliasEditorModule->unlock(); } } @@ -987,19 +993,23 @@ bool AliasEditorWidget::removeItem(AliasEditorTreeWidgetItem * it, bool * pbYesT } g_pAliasEditorModule->lock(); - int ret = QMessageBox::question(this, __tr2qs_ctx("Confirm Removing Item - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor")); + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs_ctx("Confirm Removing Item - KVIrc", "editor")); + pMsgBox.setText(szMsg); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs_ctx("Yes", "editor"), QMessageBox::YesRole); + QAbstractButton * pAlwaysButton = pMsgBox.addButton(__tr2qs_ctx("Yes to All", "editor"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton(__tr2qs_ctx("No", "editor"), QMessageBox::NoRole); + pMsgBox.setDefaultButton(qobject_cast<QPushButton *>(pNoButton)); + pMsgBox.exec(); g_pAliasEditorModule->unlock(); - switch(ret) + if(pMsgBox.clickedButton() == pYesButton) { - case 0: - // nothing - break; - case 1: - *pbYesToAll = true; - break; - default: - return false; - break; + // nothing + } else if(pMsgBox.clickedButton() == pAlwaysButton) { + *pbYesToAll = true; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + return false; } } @@ -1048,8 +1058,7 @@ QString AliasEditorWidget::askForAliasName(const QString & szAction, const QStri g_pAliasEditorModule->lock(); QMessageBox::warning(this, __tr2qs_ctx("Invalid or Missing Name - KVIrc", "editor"), - __tr2qs_ctx("You must specify a valid name for the alias.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("You must specify a valid name for the alias.", "editor")); g_pAliasEditorModule->unlock(); continue; } @@ -1061,8 +1070,7 @@ QString AliasEditorWidget::askForAliasName(const QString & szAction, const QStri g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Aliases names can contain only letters, digits, underscores and '::' namespace separators.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Aliases names can contain only letters, digits, underscores and '::' namespace separators.", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; @@ -1075,8 +1083,7 @@ QString AliasEditorWidget::askForAliasName(const QString & szAction, const QStri g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Stray ':' character in alias name: did you mean ...<namespace>::<name>?", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Stray ':' character in alias name: did you mean ...<namespace>::<name>?", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; @@ -1086,8 +1093,7 @@ QString AliasEditorWidget::askForAliasName(const QString & szAction, const QStri g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Found an empty namespace in alias name.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Found an empty namespace in alias name.", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; @@ -1117,8 +1123,7 @@ QString AliasEditorWidget::askForNamespaceName(const QString & szAction, const Q g_pAliasEditorModule->lock(); QMessageBox::warning(this, __tr2qs_ctx("Invalid or Missing Name - KVIrc", "editor"), - __tr2qs_ctx("You must specify a valid name for the namespace.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("You must specify a valid name for the namespace.", "editor")); g_pAliasEditorModule->unlock(); continue; } @@ -1130,8 +1135,7 @@ QString AliasEditorWidget::askForNamespaceName(const QString & szAction, const Q g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; @@ -1144,8 +1148,7 @@ QString AliasEditorWidget::askForNamespaceName(const QString & szAction, const Q g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Stray ':' character in namespace name: did you mean... <namespace>::<name>?", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Stray ':' character in namespace name: did you mean... <namespace>::<name>?", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; @@ -1155,8 +1158,7 @@ QString AliasEditorWidget::askForNamespaceName(const QString & szAction, const Q g_pAliasEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Found an empty namespace in namespace name.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Found an empty namespace in namespace name.", "editor")); g_pAliasEditorModule->unlock(); szNewName = ""; continue; diff --git a/src/modules/classeditor/ClassEditorWindow.cpp b/src/modules/classeditor/ClassEditorWindow.cpp index c851cffdc..da0d5ffae 100644 --- a/src/modules/classeditor/ClassEditorWindow.cpp +++ b/src/modules/classeditor/ClassEditorWindow.cpp @@ -514,8 +514,7 @@ void ClassEditorWidget::renameFunction() g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This function name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This function name is already in use. Please choose another one.", "editor")); g_pClassEditorModule->unlock(); return; } @@ -577,8 +576,7 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem) g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor")); g_pClassEditorModule->unlock(); return; } @@ -587,8 +585,7 @@ void ClassEditorWidget::renameClass(ClassEditorTreeWidgetItem * pClassItem) g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Bad Namespace Name","editor"), - __tr2qs_ctx("Found an empty namespace in namespace name","editor"), - __tr2qs_ctx("OK, Let me try again...","editor")); + __tr2qs_ctx("Found an empty namespace in namespace name","editor")); g_pClassEditorModule->unlock(); szNewName = ""; continue; @@ -666,15 +663,13 @@ void ClassEditorWidget::renameNamespace(ClassEditorTreeWidgetItem * pOldNamespac { QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This class name is already in use. Please choose another one.", "editor")); } else { QMessageBox::information(this, __tr2qs_ctx("Name Already Exists - KVIrc", "editor"), - __tr2qs_ctx("This namespace name is already in use. Please choose another one.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("This namespace name is already in use. Please choose another one.", "editor")); } g_pClassEditorModule->unlock(); return; @@ -1094,7 +1089,7 @@ void ClassEditorWidget::exportSelectionInSinglesFiles(KviPointerList<ClassEditor if(!pList->first()) { g_pClassEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("Must select an entry from the list to export!", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("Must select an entry from the list to export!", "editor")); g_pClassEditorModule->unlock(); return; } @@ -1126,13 +1121,23 @@ void ClassEditorWidget::exportSelectionInSinglesFiles(KviPointerList<ClassEditor QString szCompletePath = m_szDir + szFileName; if(KviFileUtils::fileExists(szCompletePath) && !bReplaceAll) { - QString szMsg = __tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?", "editor").arg(szFileName); - int iRet = QMessageBox::question(this, __tr2qs_ctx("Confirm Replacing File - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor")); - if(iRet != 2) + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs_ctx("Confirm Replacing File - KVIrc", "editor")); + pMsgBox.setText(QString(__tr2qs_ctx("The file \"%1\" exists. Do you want to replace it?", "editor")).arg(szFileName)); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs_ctx("Yes", "editor"), QMessageBox::YesRole); + QAbstractButton * pAlwaysButton = pMsgBox.addButton(__tr2qs_ctx("Yes to All", "editor"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton( __tr2qs_ctx("No", "editor"), QMessageBox::NoRole); + pMsgBox.setDefaultButton(qobject_cast<QPushButton *>(pNoButton)); + pMsgBox.exec(); + if(pMsgBox.clickedButton() == pYesButton) { KviFileUtils::writeFile(szCompletePath, szTmp); - if(iRet == 1) - bReplaceAll = true; + } else if(pMsgBox.clickedButton() == pAlwaysButton) { + KviFileUtils::writeFile(szCompletePath, szTmp); + bReplaceAll = true; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + // nothing } } else @@ -1197,7 +1202,7 @@ void ClassEditorWidget::exportClasses(bool bSelectedOnly, bool bSingleFiles) if(szOut.isEmpty()) { g_pClassEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("The exported class file could be empty: cowardly refusing to write it", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Warning While Exporting - KVIrc", "editor"), __tr2qs_ctx("The exported class file could be empty: cowardly refusing to write it", "editor")); g_pClassEditorModule->unlock(); return; } @@ -1238,7 +1243,7 @@ void ClassEditorWidget::exportClasses(bool bSelectedOnly, bool bSingleFiles) if(!KviFileUtils::writeFile(szFile, szOut)) { g_pClassEditorModule->lock(); - QMessageBox::warning(this, __tr2qs_ctx("Write to Classes File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the classes file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Write to Classes File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the classes file.", "editor")); g_pClassEditorModule->unlock(); } } @@ -1372,19 +1377,23 @@ bool ClassEditorWidget::removeItem(ClassEditorTreeWidgetItem * pItem, KviPointer } g_pClassEditorModule->lock(); - int iRet = QMessageBox::question(this, __tr2qs_ctx("Confirm Removing Item - KVIrc", "editor"), szMsg, __tr2qs_ctx("Yes", "editor"), __tr2qs_ctx("Yes to All", "editor"), __tr2qs_ctx("No", "editor")); + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs_ctx("Confirm Removing Item - KVIrc", "editor")); + pMsgBox.setText(szMsg); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs_ctx("Yes", "editor"), QMessageBox::YesRole); + QAbstractButton * pAlwaysButton = pMsgBox.addButton(__tr2qs_ctx("Yes to All", "editor"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton(__tr2qs_ctx("No", "editor"), QMessageBox::NoRole); + pMsgBox.setDefaultButton(qobject_cast<QPushButton *>(pNoButton)); + pMsgBox.exec(); g_pClassEditorModule->unlock(); - switch(iRet) + if(pMsgBox.clickedButton() == pYesButton) { - case 0: - // nothing - break; - case 1: - *pbYesToAll = true; - break; - default: - return false; - break; + // nothing + } else if(pMsgBox.clickedButton() == pAlwaysButton) { + *pbYesToAll = true; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + return false; } } @@ -1511,8 +1520,7 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr g_pClassEditorModule->lock(); QMessageBox::warning(this, __tr2qs_ctx("Invalid or Missing Name - KVIrc", "editor"), - __tr2qs_ctx("You must specify a valid name for the namespace.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("You must specify a valid name for the namespace.", "editor")); g_pClassEditorModule->unlock(); continue; } @@ -1524,8 +1532,7 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Namespace names can contain only letters, digits, underscores and '::' namespace separators.", "editor")); g_pClassEditorModule->unlock(); szNewName = ""; continue; @@ -1538,8 +1545,7 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Stray ':' character in namespace name: did you mean ...<namespace>::<name>?", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Stray ':' character in namespace name: did you mean ...<namespace>::<name>?", "editor")); g_pClassEditorModule->unlock(); szNewName = ""; continue; @@ -1549,8 +1555,7 @@ bool ClassEditorWidget::askForNamespaceName(const QString & szAction, const QStr g_pClassEditorModule->lock(); QMessageBox::information(this, __tr2qs_ctx("Invalid Name - KVIrc", "editor"), - __tr2qs_ctx("Found an empty namespace in namespace name.", "editor"), - __tr2qs_ctx("OK, Let me try again...", "editor")); + __tr2qs_ctx("Found an empty namespace in namespace name.", "editor")); g_pClassEditorModule->unlock(); szNewName = ""; continue; @@ -1713,8 +1718,7 @@ void ClassEditorWidget::build() skipClasses.append(lInheritedClasses.at(u)); } } - QMessageBox::critical(this, __tr2qs_ctx("Compilation Error - KVIrc", "editor"), szError, - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Compilation Error - KVIrc", "editor"), szError); break; } //else qDebug("class compiled %s :\n",szClass.toUtf8().data()); diff --git a/src/modules/eventeditor/EventEditorWindow.cpp b/src/modules/eventeditor/EventEditorWindow.cpp index bb7d86e62..df9bbd40e 100644 --- a/src/modules/eventeditor/EventEditorWindow.cpp +++ b/src/modules/eventeditor/EventEditorWindow.cpp @@ -515,7 +515,7 @@ void EventEditor::exportCurrentHandler() if(!KviFileUtils::writeFile(szFile, szOut)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the events file.", "editor"), __tr2qs_ctx("&OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the events file.", "editor")); } } @@ -555,7 +555,7 @@ void EventEditor::exportAllEvents() if(!KviFileUtils::writeFile(szFile, out)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed", "editor"), __tr2qs_ctx("Unable to write to the events file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed", "editor"), __tr2qs_ctx("Unable to write to the events file.", "editor")); } } diff --git a/src/modules/filetransferwindow/FileTransferWindow.cpp b/src/modules/filetransferwindow/FileTransferWindow.cpp index a59b82126..bc8e75c44 100644 --- a/src/modules/filetransferwindow/FileTransferWindow.cpp +++ b/src/modules/filetransferwindow/FileTransferWindow.cpp @@ -640,15 +640,14 @@ void FileTransferWindow::deleteLocalFile() QString szName = pTransfer->localFileName(); QString szTmp = QString(__tr2qs_ctx("Do you really want to delete the file %1?", "filetransferwindow")).arg(szName); - if(QMessageBox::warning(this, __tr2qs_ctx("Confirm File Delete - KVIrc", "filetransferwindow"), - szTmp, __tr2qs_ctx("Yes", "filetransferwindow"), __tr2qs_ctx("No", "filetransferwindow")) - != 0) + if(QMessageBox::question(this, __tr2qs_ctx("Confirm File Delete - KVIrc", "filetransferwindow"), + szTmp) + != QMessageBox::Yes) return; if(!QFile::remove(szName)) QMessageBox::warning(this, __tr2qs_ctx("Deleting File Failed - KVIrc", "filetransferwindow"), - __tr2qs_ctx("Failed to remove the file", "filetransferwindow"), - __tr2qs_ctx("OK", "filetransferwindow")); + __tr2qs_ctx("Failed to remove the file", "filetransferwindow")); } void FileTransferWindow::openLocalFile() @@ -833,7 +832,8 @@ void FileTransferWindow::clearAll() // If any transfer is active asks for confirm if(!bHaveAllTerminated) - if(QMessageBox::warning(this, __tr2qs_ctx("Confirm Clearing All Transfers - KVIrc", "filetransferwindow"), szTmp, __tr2qs_ctx("Yes", "filetransferwindow"), __tr2qs_ctx("No", "filetransferwindow")) != 0) + if(QMessageBox::question(this, __tr2qs_ctx("Confirm Clearing All Transfers - KVIrc", "filetransferwindow") + , szTmp) != QMessageBox::Yes) return; KviFileTransferManager::instance()->killAllTransfers(); diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp index 32a773b35..7eeb4e57e 100644 --- a/src/modules/help/libkvihelp.cpp +++ b/src/modules/help/libkvihelp.cpp @@ -94,7 +94,7 @@ static bool help_kvs_cmd_open(KviKvsModuleCommandCall * c) if(szParam.isEmpty()) { szParam = QString("index.html"); - qDebug("No file, use default at path %s", szDoc.toUtf8().data()); + qDebug("No file, use default at path %s", szParam.toUtf8().data()); } /* diff --git a/src/modules/logview/LogViewWindow.cpp b/src/modules/logview/LogViewWindow.cpp index 754e6bef5..071c9d7c5 100644 --- a/src/modules/logview/LogViewWindow.cpp +++ b/src/modules/logview/LogViewWindow.cpp @@ -481,9 +481,8 @@ void LogViewWindow::deleteCurrent() if(QMessageBox::question( this, __tr2qs_ctx("Confirm Current User Log Deletion", "log"), - __tr2qs_ctx("Do you really wish to delete this log?", "log"), - __tr2qs("Yes"), __tr2qs("No"), nullptr, 1) - != 0) + __tr2qs_ctx("Do you really wish to delete this log?", "log")) + != QMessageBox::Yes) return; KviFileUtils::removeFile(pItem->fileName()); @@ -499,9 +498,8 @@ void LogViewWindow::deleteCurrent() if(QMessageBox::question( this, __tr2qs_ctx("Confirm Current User Logs Deletion", "log"), - __tr2qs_ctx("Do you really wish to delete all these logs?", "log"), - __tr2qs("Yes"), __tr2qs("No"), nullptr, 1) - != 0) + __tr2qs_ctx("Do you really wish to delete all these logs?", "log")) + != QMessageBox::Yes) return; KviPointerList<LogListViewItem> itemsList; itemsList.setAutoDelete(false); diff --git a/src/modules/options/OptionsWidget_identity.cpp b/src/modules/options/OptionsWidget_identity.cpp index 49496729b..cf5821705 100644 --- a/src/modules/options/OptionsWidget_identity.cpp +++ b/src/modules/options/OptionsWidget_identity.cpp @@ -566,8 +566,7 @@ void OptionsWidget_identityAvatar::chooseAvatar() __tr2qs_ctx("Failed to load the avatar image.<br>" "It may be an inaccessible file or an " "unsupported image format.", - "options"), - QMessageBox::Ok, QMessageBox::NoButton); + "options")); } // else loaded! } else @@ -577,7 +576,7 @@ void OptionsWidget_identityAvatar::chooseAvatar() "<b>%1</b>", "options")) .arg(dlg.errorMessage()); - QMessageBox::warning(this, __tr2qs_ctx("Avatar Download Failed - KVIrc", "options"), szTmp, QMessageBox::Ok, QMessageBox::NoButton); + QMessageBox::warning(this, __tr2qs_ctx("Avatar Download Failed - KVIrc", "options"), szTmp); szCurrent = ""; m_pLocalAvatar->setNull(); } @@ -616,8 +615,7 @@ void OptionsWidget_identityAvatar::chooseAvatar() __tr2qs_ctx("Failed to load the avatar image.<br>" "It may be an inaccessible file or an " "unsupported image format.", - "options"), - QMessageBox::Ok, QMessageBox::NoButton); + "options")); szCurrent = ""; } } @@ -867,7 +865,7 @@ void OptionsWidget_identityProfile::editProfileOkPressed() { if(m_pEditor->m_pNameEdit->text() == m_pTreeWidget->topLevelItem(i)->text(0) && i != m_iCurrentEditedProfile) { - QMessageBox::warning(this, __tr2qs_ctx("Invalid Profile Rule - KVIrc", "options"), __tr2qs_ctx("There is already a profile with that name", "options"), __tr2qs_ctx("OK", "options")); + QMessageBox::warning(this, __tr2qs_ctx("Invalid Profile Rule - KVIrc", "options"), __tr2qs_ctx("There is already a profile with that name", "options")); return; } } diff --git a/src/modules/options/OptionsWidget_nickserv.cpp b/src/modules/options/OptionsWidget_nickserv.cpp index 016aa69a5..471aba36b 100644 --- a/src/modules/options/OptionsWidget_nickserv.cpp +++ b/src/modules/options/OptionsWidget_nickserv.cpp @@ -145,17 +145,16 @@ bool NickServRuleEditor::validate() QString s = m_pRegisteredNickEdit->text(); QString m = __tr2qs_ctx("Invalid NickServ Rule - KVIrc", "options"); - QString o = __tr2qs_ctx("OK", "options"); if(s.isEmpty()) { - QMessageBox::warning(this, m, __tr2qs_ctx("The nickname field can't be empty!", "options"), o); + QMessageBox::warning(this, m, __tr2qs_ctx("The nickname field can't be empty!", "options")); return false; } if(s.indexOf(QChar(' ')) != -1) { - QMessageBox::warning(this, m, __tr2qs_ctx("The nickname field can't contain spaces!", "options"), o); + QMessageBox::warning(this, m, __tr2qs_ctx("The nickname field can't contain spaces!", "options")); return false; } @@ -163,7 +162,7 @@ bool NickServRuleEditor::validate() if(s.isEmpty()) { - QMessageBox::warning(this, m, __tr2qs_ctx("The NickServ mask can't be empty!<br>You must put at least * there.", "options"), o); + QMessageBox::warning(this, m, __tr2qs_ctx("The NickServ mask can't be empty!<br>You must put at least * there.", "options")); return false; } @@ -171,7 +170,7 @@ bool NickServRuleEditor::validate() if(s.isEmpty()) { - QMessageBox::warning(this, m, __tr2qs_ctx("The message regexp can't be empty!<br>You must put at least * there.", "options"), o); + QMessageBox::warning(this, m, __tr2qs_ctx("The message regexp can't be empty!<br>You must put at least * there.", "options")); return false; } @@ -179,7 +178,7 @@ bool NickServRuleEditor::validate() if(s.isEmpty()) { - QMessageBox::warning(this, m, __tr2qs_ctx("The IDENTIFY command can't be empty!", "options"), o); + QMessageBox::warning(this, m, __tr2qs_ctx("The IDENTIFY command can't be empty!", "options")); return false; } diff --git a/src/modules/options/OptionsWidget_servers.cpp b/src/modules/options/OptionsWidget_servers.cpp index 3230a3bf1..828e92a80 100644 --- a/src/modules/options/OptionsWidget_servers.cpp +++ b/src/modules/options/OptionsWidget_servers.cpp @@ -2161,8 +2161,8 @@ void OptionsWidget_servers::clearList() QString txt = __tr2qs_ctx("If you click <b>Yes</b>, all of your saved networks, servers, settings, and passwords will be lost.<br>" "Would you like to continue?", "options"); - if(QMessageBox::question(this,__tr2qs_ctx("Confirm Clearing Server List - KVIrc", "options"), txt, - __tr2qs_ctx("Yes", "options"), __tr2qs_ctx("No", "options"), nullptr, 1) != 0) return; + if(QMessageBox::question(this,__tr2qs_ctx("Confirm Clearing Server List - KVIrc", "options"), txt) != QMessageBox::Yes) + return; m_pTreeWidget->clear(); m_pLastEditedItem = nullptr; diff --git a/src/modules/options/OptionsWidget_textEncoding.cpp b/src/modules/options/OptionsWidget_textEncoding.cpp index 249e14784..d23416d8b 100644 --- a/src/modules/options/OptionsWidget_textEncoding.cpp +++ b/src/modules/options/OptionsWidget_textEncoding.cpp @@ -222,7 +222,7 @@ void OptionsWidget_textEncoding::commit() g_szPrevSetLocale = m_pForcedLocaleCombo->itemText(idx); if(!KviFileUtils::writeFile(szLangFile, m_pForcedLocaleCombo->itemText(idx))) { - QMessageBox::critical(this, "Writing to File Failed - KVIrc", __tr2qs_ctx("Unable to write language information to", "options") + "\n" + szLangFile, __tr2qs_ctx("OK", "options")); + QMessageBox::critical(this, "Writing to File Failed - KVIrc", __tr2qs_ctx("Unable to write language information to", "options") + "\n" + szLangFile); } } diff --git a/src/modules/popupeditor/PopupEditorWindow.cpp b/src/modules/popupeditor/PopupEditorWindow.cpp index 62b3bd855..2edc4620b 100644 --- a/src/modules/popupeditor/PopupEditorWindow.cpp +++ b/src/modules/popupeditor/PopupEditorWindow.cpp @@ -1148,9 +1148,8 @@ void PopupEditorWidget::popupRefresh(const QString & szName) if(ch == m_pLastEditedItem) { if( - QMessageBox::warning(nullptr, __tr2qs_ctx("Confirm Overwriting Current - KVIrc", "editor"), - __tr2qs_ctx("An external script has changed the popup you are currently editing. Do you want to accept the external changes?", "editor"), - QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) != QMessageBox::Yes) + QMessageBox::question(nullptr, __tr2qs_ctx("Confirm Overwriting Current - KVIrc", "editor"), + __tr2qs_ctx("An external script has changed the popup you are currently editing. Do you want to accept the external changes?", "editor")) != QMessageBox::Yes) return; } KviKvsPopupMenu * pCopy = new KviKvsPopupMenu(szName); @@ -1225,7 +1224,7 @@ void PopupEditorWidget::exportCurrentPopup() if(!KviFileUtils::writeFile(szFile, szOut)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the popups file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the popups file.", "editor")); } } @@ -1275,7 +1274,7 @@ void PopupEditorWidget::exportPopups(bool bSelectedOnly) if(!KviFileUtils::writeFile(szFile, out)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the popups file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the popups file.", "editor")); } } diff --git a/src/modules/raweditor/RawEditorWindow.cpp b/src/modules/raweditor/RawEditorWindow.cpp index 0cfb8489c..e3277673d 100644 --- a/src/modules/raweditor/RawEditorWindow.cpp +++ b/src/modules/raweditor/RawEditorWindow.cpp @@ -423,7 +423,7 @@ void RawEditorWidget::exportCurrentHandler() if(!KviFileUtils::writeFile(szFile, szOut)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the RAW events file.", "editor"), __tr2qs_ctx("&OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the RAW events file.", "editor")); } } @@ -460,7 +460,7 @@ void RawEditorWidget::exportAllEvents() if(!KviFileUtils::writeFile(szFile, out)) { - QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the RAW events file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the RAW events file.", "editor")); } } diff --git a/src/modules/setup/SetupWizard.cpp b/src/modules/setup/SetupWizard.cpp index 478e2a8ac..30be5a079 100644 --- a/src/modules/setup/SetupWizard.cpp +++ b/src/modules/setup/SetupWizard.cpp @@ -734,13 +734,8 @@ void SetupWizard::chooseOldDataPath() this, __tr2qs("Confirm Setting Configuration Folder - KVIrc Setup"), __tr2qs("The folder %1 doesn't seem to be a valid KVIrc settings folder. Do you want to use it anyway?") - .arg(szBuffer), - __tr2qs("&Yes"), - __tr2qs("&No"), - QString(), - 0, - 1) - == 0) + .arg(szBuffer)) + == QMessageBox::Yes) m_pOldDataPathEdit->setText(szBuffer); } else @@ -940,9 +935,8 @@ void SetupWizard::setUrlHandlers() void SetupWizard::reject() { - if(QMessageBox::warning(this, __tr2qs("Confirm Setup Abort - KVIrc Setup"), - __tr2qs("You have chosen to abort the setup.<br>KVIrc can't run until you complete this procedure.<br><br>Do you really wish to abort?"), - QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape) + if(QMessageBox::question(this, __tr2qs("Confirm Setup Abort - KVIrc Setup"), + __tr2qs("You have chosen to abort the setup.<br>KVIrc can't run until you complete this procedure.<br><br>Do you really wish to abort?")) != QMessageBox::Yes) return; diff --git a/src/modules/sharedfileswindow/SharedFilesWindow.cpp b/src/modules/sharedfileswindow/SharedFilesWindow.cpp index 5e200ab8c..af1e947d1 100644 --- a/src/modules/sharedfileswindow/SharedFilesWindow.cpp +++ b/src/modules/sharedfileswindow/SharedFilesWindow.cpp @@ -155,16 +155,14 @@ void SharedFileEditDialog::okClicked() QMessageBox::warning(this, __tr2qs_ctx("Invalid Expiry Time - KVIrc", "sharedfileswindow"), __tr2qs_ctx("The expiry date/time is in the past: please either remove the \"Expires at\"" "check mark or specify a expiry date/time in the future", - "sharedfileswindow"), - __tr2qs_ctx("OK", "sharedfileswindow")); + "sharedfileswindow")); return; } if(szName.isEmpty()) { QMessageBox::warning(this, __tr2qs_ctx("Invalid Share Name - KVIrc", "sharedfileswindow"), - __tr2qs_ctx("The share name can't be empty, please correct it", "sharedfileswindow"), - __tr2qs_ctx("OK", "sharedfileswindow")); + __tr2qs_ctx("The share name can't be empty, please correct it", "sharedfileswindow")); return; } @@ -172,8 +170,7 @@ void SharedFileEditDialog::okClicked() if(!(f.exists() && f.isFile() && f.isReadable())) { QMessageBox::warning(this, __tr2qs_ctx("Error Opening File - KVIrc", "sharedfileswindow"), - __tr2qs_ctx("The file doesn't exist or it is not readable, please check the path", "sharedfileswindow"), - __tr2qs_ctx("OK", "sharedfileswindow")); + __tr2qs_ctx("The file doesn't exist or it is not readable, please check the path", "sharedfileswindow")); return; } diff --git a/src/modules/theme/PackThemeDialog.cpp b/src/modules/theme/PackThemeDialog.cpp index 91bde9429..10a8ef622 100644 --- a/src/modules/theme/PackThemeDialog.cpp +++ b/src/modules/theme/PackThemeDialog.cpp @@ -353,8 +353,7 @@ void PackThemeImageWidget::imageSelectionChanged(const QString & szImagePath) return; } - QMessageBox::critical(this, __tr2qs_ctx("Export Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected image!", "theme"), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Export Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected image!", "theme")); m_pImageSelector->setSelection(""); m_pImageLabel->setPixmap(QPixmap()); @@ -433,15 +432,13 @@ bool PackThemeDialog::packTheme() { QMessageBox::critical(this, __tr2qs_ctx("Export Theme - KVIrc", "theme"), - szError, - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + szError); return false; } QMessageBox::information(this, __tr2qs_ctx("Exporting Theme - KVIrc", "theme"), - __tr2qs("Theme package saved successfully."), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + __tr2qs("Theme package saved successfully.")); return true; } diff --git a/src/modules/theme/SaveThemeDialog.cpp b/src/modules/theme/SaveThemeDialog.cpp index 00ac0b17f..3043d31ae 100644 --- a/src/modules/theme/SaveThemeDialog.cpp +++ b/src/modules/theme/SaveThemeDialog.cpp @@ -226,8 +226,7 @@ void SaveThemeDialog::imageSelectionChanged(const QString & szImagePath) return; } - QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected image!", "theme"), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected image!", "theme")); m_pImageSelector->setSelection(""); m_pImageLabel->setPixmap(QPixmap()); @@ -248,8 +247,7 @@ void SaveThemeDialog::makeScreenshot() g_pApp->getTmpFileName(szFileName, "screenshot.png"); if(!ThemeFunctions::makeKVIrcScreenshot(szFileName)) { - QMessageBox::critical(this, __tr2qs_ctx("Acquire Screenshot - KVIrc", "theme"), __tr2qs_ctx("Failed to make a theme screenshot.", "theme"), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Acquire Screenshot - KVIrc", "theme"), __tr2qs_ctx("Failed to make a theme screenshot.", "theme")); return; } m_pImageSelector->setSelection(szFileName); @@ -264,8 +262,7 @@ bool SaveThemeDialog::saveTheme() sto.setName(m_pThemeNameEdit->text()); if(sto.name().isEmpty()) { - QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("You must choose a theme name.", "theme"), QMessageBox::Ok, - QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("You must choose a theme name.", "theme")); return false; } @@ -286,8 +283,7 @@ bool SaveThemeDialog::saveTheme() QString szAbsDir = sto.directory(); if(!KviFileUtils::makeDir(szAbsDir)) { - QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Unable to create theme directory.", "theme"), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Unable to create theme directory.", "theme")); return false; } @@ -295,8 +291,7 @@ bool SaveThemeDialog::saveTheme() { QString szErr = sto.lastError(); QString szMsg2 = QString(__tr2qs_ctx("Unable to save theme: %1", "theme")).arg(szErr); - QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), szMsg2, - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), szMsg2); return false; } // write down the screenshot, if needed @@ -305,8 +300,7 @@ bool SaveThemeDialog::saveTheme() { if(!KviTheme::saveScreenshots(sto, m_szScreenshotPath)) { - QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected screenshot image: please fix it", "theme"), - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected screenshot image: please fix it", "theme")); setCurrentPage(m_pImageSelectionPage); return false; } @@ -314,8 +308,7 @@ bool SaveThemeDialog::saveTheme() QString szMsg = __tr2qs_ctx("Theme saved successfully to %1", "theme").arg(szAbsDir); - QMessageBox::information(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), szMsg, QMessageBox::Ok, - QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::information(this, __tr2qs_ctx("Save Current Theme - KVIrc", "theme"), szMsg); return true; } diff --git a/src/modules/theme/ThemeManagementDialog.cpp b/src/modules/theme/ThemeManagementDialog.cpp index a2ba82c0a..fb6317000 100644 --- a/src/modules/theme/ThemeManagementDialog.cpp +++ b/src/modules/theme/ThemeManagementDialog.cpp @@ -359,8 +359,7 @@ void ThemeManagementDialog::applyCurrentTheme() { QString szErr = out.lastError(); QString szMsg = QString(__tr2qs_ctx("Failed to apply the specified theme: %1", "theme")).arg(szErr); - QMessageBox::critical(this, __tr2qs_ctx("Apply Theme - KVIrc", "theme"), szMsg, - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::critical(this, __tr2qs_ctx("Apply Theme - KVIrc", "theme"), szMsg); return; } diff --git a/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp b/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp index c2348b1d0..c4f818062 100644 --- a/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp +++ b/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp @@ -251,7 +251,7 @@ void CustomToolBarPropertiesDialog::okClicked() { if(m_szLabel.isEmpty()) { - QMessageBox::information(this, __tr2qs_ctx("Invalid Toolbar Label - KVIrc", "editor"), __tr2qs_ctx("The toolbar label can't be empty!", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::information(this, __tr2qs_ctx("Invalid Toolbar Label - KVIrc", "editor"), __tr2qs_ctx("The toolbar label can't be empty!", "editor")); return; } @@ -264,12 +264,21 @@ void CustomToolBarPropertiesDialog::okClicked() { if(m_szId != m_szOriginalId) { - if(QMessageBox::information(this, __tr2qs_ctx("Duplicate Toolbar ID - KVIrc", "editor"), - __tr2qs_ctx("The specified toolbar ID already exists.<br>" - "Would you like KVIrc to assign it automatically (so it doesn't " - "collide with any other toolbar) or you prefer to do it manually?", "editor"), - __tr2qs_ctx("Manually", "editor"), __tr2qs_ctx("Automatically", "editor")) == 0) + QMessageBox pMsgBox; + pMsgBox.setWindowTitle(__tr2qs_ctx("Duplicate Toolbar ID - KVIrc", "editor")); + pMsgBox.setText(__tr2qs_ctx("The specified toolbar ID already exists.<br>" + "Would you like KVIrc to assign it automatically (so it doesn't " + "collide with any other toolbar) or you prefer to do it manually?", "editor")); + pMsgBox.setIcon(QMessageBox::Question); + QAbstractButton * pYesButton = pMsgBox.addButton(__tr2qs_ctx("Manually", "editor"), QMessageBox::YesRole); + QAbstractButton * pNoButton = pMsgBox.addButton(__tr2qs_ctx("Automatically", "editor"), QMessageBox::NoRole); + pMsgBox.exec(); + if(pMsgBox.clickedButton() == pYesButton) + { return; + } else if(pMsgBox.clickedButton() == pNoButton || pMsgBox.clickedButton() == nullptr) { + // nothing + } m_szId = KviCustomToolBarManager::instance()->idForNewToolBar(m_szLabel); } } @@ -416,19 +425,15 @@ void CustomizeToolBarsDialog::exportToolBar() QString szCode; - int ret = QMessageBox::question(this, + QMessageBox::StandardButton ret = QMessageBox::question(this, __tr2qs_ctx("Confirm Toolbar Export - KVIrc", "editor"), __tr2qs_ctx("Do you want the associated actions to be exported with the toolbar?", "editor"), - __tr2qs_ctx("Yes", "editor"), - __tr2qs_ctx("No", "editor"), - __tr2qs_ctx("Cancel", "editor")); + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); - if(ret == 2) + if(ret == QMessageBox::Cancel) return; - bool bExportActions = ret == 0; - - if(bExportActions) + if(ret == QMessageBox::Yes) { KviPointerList<QString> * a = t->descriptor()->actions(); if(a) @@ -475,7 +480,7 @@ void CustomizeToolBarsDialog::exportToolBar() if(!KviFileUtils::writeFile(szFile, szCode)) { - QMessageBox::warning(this, __tr2qs_ctx("Write to Toolbar File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the toolbar file.", "editor"), __tr2qs_ctx("OK", "editor")); + QMessageBox::warning(this, __tr2qs_ctx("Write to Toolbar File Failed - KVIrc", "editor"), __tr2qs_ctx("Unable to write to the toolbar file.", "editor")); } } diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index d0562ff28..56e53bf47 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -192,7 +192,7 @@ void UrlDialog::remove() { if(!m_pUrlList->currentItem()) { - QMessageBox::warning(nullptr, __tr2qs("Entry Selection - KVIrc"), __tr2qs("Must select a URL entry from the list to remove it."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::warning(nullptr, __tr2qs("Entry Selection - KVIrc"), __tr2qs("Must select a URL entry from the list to remove it.")); return; } @@ -270,7 +270,7 @@ void UrlDialog::sayToWin(QAction * act) } else { - QMessageBox::warning(nullptr, __tr2qs("Window Not Found - KVIrc"), __tr2qs("Window not found."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::warning(nullptr, __tr2qs("Window Not Found - KVIrc"), __tr2qs("Window not found.")); } } @@ -458,7 +458,7 @@ void BanFrame::removeBan() if(!m_pBanList->currentItem()->isSelected()) { - QMessageBox::warning(nullptr, __tr2qs("Entry Selection - KVIrc"), __tr2qs("Must select a ban entry from the list to remove it."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + QMessageBox::warning(nullptr, __tr2qs("Entry Selection - KVIrc"), __tr2qs("Must select a ban entry from the list to remove it.")); return; } QString item(m_pBanList->currentItem()->text()); |
