From 57ebe98d50a8ef3f1f5410e108ac4bb4469ac360 Mon Sep 17 00:00:00 2001 From: Elvio Basello Date: Tue, 7 Sep 2010 19:09:25 +0000 Subject: fixed rename for classes and functions git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4989 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/classeditor/classeditor.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/modules/classeditor/classeditor.cpp') diff --git a/src/modules/classeditor/classeditor.cpp b/src/modules/classeditor/classeditor.cpp index 5452d0113..9b080632c 100644 --- a/src/modules/classeditor/classeditor.cpp +++ b/src/modules/classeditor/classeditor.cpp @@ -494,8 +494,10 @@ bool KviClassEditor::hasSelectedItems() bool KviClassEditor::classExists(QString & szFullItemName) { - if (m_pClasses->find(szFullItemName)) return true; - else return false; + if(m_pClasses->find(szFullItemName)) + return true; + else + return false; } void KviClassEditor::renameFunction() @@ -534,20 +536,17 @@ void KviClassEditor::renameFunction() } } currentItemChanged(pFunction,pFunction); - - } - return; - } - if(findFunction(szNewFunctionName,pParentClass) && !KviQString::equalCS(szFunctionName,szNewFunctionName)) - { - g_pClassEditorModule->lock(); - QMessageBox::information(this, + } else { + g_pClassEditorModule->lock(); + QMessageBox::information(this, __tr2qs_ctx("Function already exists","editor"), __tr2qs_ctx("This name is already in use. Please choose another one.","editor"), __tr2qs_ctx("Ok, Let me try again...","editor")); - g_pClassEditorModule->unlock(); - return; + g_pClassEditorModule->unlock(); + return; + } } + pFunction->setName(szNewFunctionName); pFunction->setReminder(szNewReminder); currentItemChanged(pFunction,pFunction); @@ -598,9 +597,7 @@ void KviClassEditor::renameClass(KviClassEditorTreeWidgetItem * pClassItem) bool bOk = askForClassName(szNewClassName,szNewInheritsClassName,true); if(!bOk) return; - if(KviQString::equalCS(szClassName,szNewClassName) && KviQString::equalCS(szInheritsClassName,szNewInheritsClassName)) - return; - if(classExists(szNewClassName) && KviQString::equalCS(szInheritsClassName,szNewInheritsClassName)) + if(classExists(szNewClassName) && KviQString::equalCS(szClassName,szNewClassName) && KviQString::equalCS(szInheritsClassName,szNewInheritsClassName)) { g_pClassEditorModule->lock(); QMessageBox::information(this, -- cgit v1.3.1-10-gc9f91