summaryrefslogtreecommitdiffstats
path: root/tdefilereplace/tdefilereplacepart.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-06-20 22:42:20 +0900
committerMichele Calgaro <[email protected]>2019-06-20 22:42:20 +0900
commit281f1ab591a1321cfd700f5a8e54da3541498a52 (patch)
tree23a2ef6303d682baf33a361b89c7bed02d846bed /tdefilereplace/tdefilereplacepart.cpp
parentbfd50121e0bef4cf7b856cd646062c9b93e7fe40 (diff)
downloadtdeutils-281f1ab591a1321cfd700f5a8e54da3541498a52.tar.gz
tdeutils-281f1ab591a1321cfd700f5a8e54da3541498a52.zip
tdefilereplace: fixed up interaction between tdefilereplacepart and
tdefilereplaceview, which was causing some odd issues with GUI updates at some times. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdefilereplace/tdefilereplacepart.cpp')
-rw-r--r--tdefilereplace/tdefilereplacepart.cpp112
1 files changed, 36 insertions, 76 deletions
diff --git a/tdefilereplace/tdefilereplacepart.cpp b/tdefilereplace/tdefilereplacepart.cpp
index 5e08355..804b0f5 100644
--- a/tdefilereplace/tdefilereplacepart.cpp
+++ b/tdefilereplace/tdefilereplacepart.cpp
@@ -159,7 +159,7 @@ void TDEFileReplacePart::slotSearchingOperation()
m_option->m_searchingOnlyMode = true;
- resetActions();
+ updateGUI();
m_searchingOperation = true;
@@ -223,7 +223,7 @@ void TDEFileReplacePart::slotReplacingOperation()
m_option->m_searchingOnlyMode = false;
- resetActions();
+ updateGUI();
m_searchingOperation = false;
@@ -242,7 +242,7 @@ void TDEFileReplacePart::slotStop()
emit setStatusBarText(i18n("Stopping..."));
m_stop = true;
TQApplication::restoreOverrideCursor();
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotCreateReport()
@@ -286,13 +286,7 @@ void TDEFileReplacePart::slotCreateReport()
Report report(m_option, rv, sv);
report.createDocument(documentPath);
- //resetActions();
-}
-
-void TDEFileReplacePart::slotStringsAdd()
-{
- m_view->slotStringsAdd();
- resetActions();
+ //updateGUI();
}
void TDEFileReplacePart::slotQuickStringsAdd()
@@ -328,29 +322,6 @@ void TDEFileReplacePart::slotQuickStringsAdd()
}
}
-void TDEFileReplacePart::slotStringsDeleteItem()
-{
- m_view->slotStringsDeleteItem();
- resetActions();
-}
-
-void TDEFileReplacePart::slotStringsEmpty()
-{
- m_view->slotStringsEmpty();
- resetActions();
-}
-
-void TDEFileReplacePart::slotStringsEdit()
-{
- m_view->slotStringsEdit();
- resetActions();
-}
-
-void TDEFileReplacePart::slotStringsSave()
-{
- m_view->slotStringsSave();
-}
-
void TDEFileReplacePart::slotStringsLoad()
{
// Selects the file to load from
@@ -360,19 +331,7 @@ void TDEFileReplacePart::slotStringsLoad()
if(!fileName.isEmpty())
loadRulesFile(fileName);
- resetActions();
-}
-
-void TDEFileReplacePart::slotStringsInvertCur()
-{
- m_view->stringsInvert(false);
- resetActions();
-}
-
-void TDEFileReplacePart::slotStringsInvertAll()
-{
- m_view->stringsInvert(true);
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile)
@@ -393,50 +352,48 @@ void TDEFileReplacePart::slotOpenRecentStringFile(const KURL& urlFile)
}
loadRulesFile(fileName);
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionRecursive()
{
m_option->m_recursive = !m_option->m_recursive;
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionBackup()
{
m_option->m_backup = !m_option->m_backup;
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionCaseSensitive()
{
m_option->m_caseSensitive = !m_option->m_caseSensitive;
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionVariables()
{
m_option->m_variables = !m_option->m_variables;
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionRegularExpressions()
{
m_option->m_regularExpressions = !m_option->m_regularExpressions;
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::slotOptionPreferences()
{
KOptionsDlg dlg(m_option, m_w, 0);
-
- if(!dlg.exec())
+ if (!dlg.exec())
+ {
return;
-
- //updating m_view
+ }
m_view->updateOptions(m_option);
-
- resetActions();
+ updateGUI();
}
void TDEFileReplacePart::showAboutApplication()
@@ -462,7 +419,7 @@ void TDEFileReplacePart::reportBug()
dlg.exec();
}
-void TDEFileReplacePart::resetActions()
+void TDEFileReplacePart::updateGUI()
{
TDEListView* rv = m_view->getResultsView(),
* sv = m_view->getStringsView();
@@ -557,7 +514,7 @@ bool TDEFileReplacePart::openURL(const KURL &url)
return launchNewProjectDialog(url);
else
{
- resetActions();
+ updateGUI();
return true;
}
}
@@ -580,6 +537,10 @@ void TDEFileReplacePart::initGUI()
break;
}
}
+
+ // GUI
+ connect(m_view, TQT_SIGNAL(updateGUI()), this, TQT_SLOT(updateGUI()));
+
// File
(void)new TDEAction(i18n("Customize Search/Replace Session..."), "projectopen", TDEShortcut(CTRL + Key_F), TQT_TQOBJECT(this), TQT_SLOT(slotSetNewParameters()), actionCollection(), "new_project");
(void)new TDEAction(i18n("&Search"), "filesearch", 0, TQT_TQOBJECT(this), TQT_SLOT(slotSearchingOperation()), actionCollection(), "search");
@@ -589,16 +550,15 @@ void TDEFileReplacePart::initGUI()
(void)new TDEAction(i18n("Cre&ate Report File..."), "document-save-as", 0, TQT_TQOBJECT(this), TQT_SLOT(slotCreateReport()), actionCollection(), "save_results");
// Strings
- (void)new TDEAction(i18n("&Add String..."), "editadd", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsAdd()), actionCollection(), "strings_add");
-
- (void)new TDEAction(i18n("&Delete String"), "editremove", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del");
- (void)new TDEAction(i18n("&Empty Strings List"), "edit-delete", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEmpty()), actionCollection(), "strings_empty");
- (void)new TDEAction(i18n("Edit Selected String..."), "edit", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsEdit()), actionCollection(), "strings_edit");
- (void)new TDEAction(i18n("&Save Strings List to File..."), "document-save-as", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsSave()), actionCollection(), "strings_save");
+ (void)new TDEAction(i18n("&Add String..."), "editadd", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsAdd()), actionCollection(), "strings_add");
+ (void)new TDEAction(i18n("&Delete String"), "editremove", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsDeleteItem()), actionCollection(), "strings_del");
+ (void)new TDEAction(i18n("&Empty Strings List"), "edit-delete", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsEmpty()), actionCollection(), "strings_empty");
+ (void)new TDEAction(i18n("Edit Selected String..."), "edit", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsEdit()), actionCollection(), "strings_edit");
+ (void)new TDEAction(i18n("&Save Strings List to File..."), "document-save-as", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsSave()), actionCollection(), "strings_save");
(void)new TDEAction(i18n("&Load Strings List From File..."), "unsortedList", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsLoad()), actionCollection(), "strings_load");
(void)new TDERecentFilesAction(i18n("&Load Recent Strings Files"), "document-open", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOpenRecentStringFile(const KURL&)), actionCollection(),"strings_load_recent");
- (void)new TDEAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert");
- (void)new TDEAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, TQT_TQOBJECT(this), TQT_SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all");
+ (void)new TDEAction(i18n("&Invert Current String (search <--> replace)"), "invert", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsInvertCur()), actionCollection(), "strings_invert");
+ (void)new TDEAction(i18n("&Invert All Strings (search <--> replace)"), "invert", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotStringsInvertAll()), actionCollection(), "strings_invert_all");
// Options
(void)new TDEToggleAction(i18n("&Include Sub-Folders"), "recursive_option", 0, TQT_TQOBJECT(this), TQT_SLOT(slotOptionRecursive()), actionCollection(), "options_recursive");
@@ -611,21 +571,21 @@ void TDEFileReplacePart::initGUI()
// Results
(void)new TDEAction(i18n("&Properties"), "informations", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultProperties()), actionCollection(), "results_infos");
(void)new TDEAction(i18n("&Open"), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfile");
- (void)new TDEAction(i18n("Open &With..."), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpen()), actionCollection(), "results_openfilewith");
-
+ (void)new TDEAction(i18n("Open &With..."), "document-open", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultOpenWith()), actionCollection(), "results_openfilewith");
if(quantaFound)
- {
- (void)new TDEAction(i18n("&Edit in Quanta"), "quanta", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile");
- }
+ {
+ (void)new TDEAction(i18n("&Edit in Quanta"), "quanta", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultEdit()), actionCollection(), "results_editfile");
+ }
(void)new TDEAction(i18n("Open Parent &Folder"), "go-up", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDirOpen()), actionCollection(), "results_opendir");
(void)new TDEAction(i18n("Remove &Entry"), "edit-clear", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultRemoveEntry()), actionCollection(), "results_removeentry");
(void)new TDEAction(i18n("&Delete"), "edit-delete", 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultDelete()), actionCollection(), "results_delete");
(void)new TDEAction(i18n("E&xpand Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeExpand()), actionCollection(), "results_treeexpand");
(void)new TDEAction(i18n("&Reduce Tree"), 0, TQT_TQOBJECT(m_view), TQT_SLOT(slotResultTreeReduce()), actionCollection(), "results_treereduce");
+
+ // Help
(void)new TDEAction(i18n("&About TDEFileReplace"), "tdefilereplace", 0, TQT_TQOBJECT(this), TQT_SLOT(showAboutApplication()), actionCollection(), "help_about_tdefilereplace");
(void)new TDEAction(i18n("TDEFileReplace &Handbook"), "help", 0, TQT_TQOBJECT(this), TQT_SLOT(appHelpActivated()), actionCollection(), "help_tdefilereplace");
(void)new TDEAction(i18n("&Report Bug"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(reportBug()), actionCollection(), "report_bug");
-
}
void TDEFileReplacePart::initView()
@@ -1648,7 +1608,7 @@ void TDEFileReplacePart::loadRulesFile(const TQString& fileName)
m_view->loadMap(docMap);
- //resetActions();
+ updateGUI();
}
bool TDEFileReplacePart::launchNewProjectDialog(const KURL & startURL)
@@ -1670,7 +1630,7 @@ bool TDEFileReplacePart::launchNewProjectDialog(const KURL & startURL)
m_view->updateOptions(m_option);
- resetActions();
+ updateGUI();
return true;
}