diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-08-23 23:11:45 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-08-23 23:11:45 +0900 |
commit | 9599fe545110b6d676da07e3361d52e1837b0e4c (patch) | |
tree | 9937a6319896ddb63e397b7172a8b8b1f2f9b18a | |
parent | 027c45db6f63a04eb31eac481f9264ab9760dce1 (diff) | |
download | tdebase-9599fe545110b6d676da07e3361d52e1837b0e4c.tar.gz tdebase-9599fe545110b6d676da07e3361d52e1837b0e4c.zip |
Kate: added checkbox to select whether to display the session name on the
window caption or not. This relates to issue #62.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | kate/app/kateconfigdialog.cpp | 29 | ||||
-rw-r--r-- | kate/app/kateconfigdialog.h | 1 | ||||
-rw-r--r-- | kate/app/katemainwindow.cpp | 28 | ||||
-rw-r--r-- | kate/app/katemainwindow.h | 1 |
4 files changed, 39 insertions, 20 deletions
diff --git a/kate/app/kateconfigdialog.cpp b/kate/app/kateconfigdialog.cpp index 38f71f2d3..883730c08 100644 --- a/kate/app/kateconfigdialog.cpp +++ b/kate/app/kateconfigdialog.cpp @@ -107,18 +107,24 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view ) // show full path in title config->setGroup("General"); - cb_fullPath = new TQCheckBox( i18n("&Show full path in title"), bgStartup); - cb_fullPath->setChecked( mainWindow->viewManager()->getShowFullPath() ); - TQWhatsThis::add(cb_fullPath,i18n("If this option is checked, the full document path will be shown in the window caption.")); - connect( cb_fullPath, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) ); + cb_fullPath = new TQCheckBox(i18n("&Show full path in title"), bgStartup); + cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath()); + TQWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption.")); + connect(cb_fullPath, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged())); + + // show session name in title + cb_showSessionName = new TQCheckBox(i18n("Show s&ession name in title"), bgStartup); + cb_showSessionName->setChecked(parent->showSessionName); + TQWhatsThis::add(cb_showSessionName, i18n("If this option is checked, the session name will be shown in the window caption.")); + connect(cb_showSessionName, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotChanged())); // sort filelist if desired - cb_sortFiles = new TQCheckBox(bgStartup); - cb_sortFiles->setText(i18n("Sort &files alphabetically in the file list")); - cb_sortFiles->setChecked(parent->filelist->sortType() == KateFileList::sortByName); - TQWhatsThis::add( cb_sortFiles, i18n( - "If this is checked, the files in the file list will be sorted alphabetically.") ); - connect( cb_sortFiles, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) ); + cb_sortFiles = new TQCheckBox(bgStartup); + cb_sortFiles->setText(i18n("Sort &files alphabetically in the file list")); + cb_sortFiles->setChecked(parent->filelist->sortType() == KateFileList::sortByName); + TQWhatsThis::add( cb_sortFiles, i18n( + "If this is checked, the files in the file list will be sorted alphabetically.") ); + connect( cb_sortFiles, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) ); // GROUP with the one below: "Behavior" bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Behavior"), frGeneral ); @@ -417,6 +423,7 @@ void KateConfigDialog::slotApply() config->writeEntry("Modified Notification", cb_modNotifications->isChecked()); mainWindow->modNotification = cb_modNotifications->isChecked(); + mainWindow->showSessionName = cb_showSessionName->isChecked(); mainWindow->syncKonsole = cb_syncKonsole->isChecked(); mainWindow->useInstance = cb_useInstance->isChecked(); mainWindow->filelist->setSortType(cb_sortFiles->isChecked() ? KateFileList::sortByName : KateFileList::sortByID); @@ -437,7 +444,7 @@ void KateConfigDialog::slotApply() } //mainWindow->externalTools->reload(); - mainWindow->viewManager()->setShowFullPath( cb_fullPath->isChecked() ); // hm, stored 2 places :( + mainWindow->viewManager()->setShowFullPath(cb_fullPath->isChecked()); mainWindow->saveOptions (); diff --git a/kate/app/kateconfigdialog.h b/kate/app/kateconfigdialog.h index 5bbfc526d..a90cdd1c0 100644 --- a/kate/app/kateconfigdialog.h +++ b/kate/app/kateconfigdialog.h @@ -65,6 +65,7 @@ class KateConfigDialog : public KDialogBase bool dataChanged; TQCheckBox *cb_fullPath; + TQCheckBox *cb_showSessionName; TQCheckBox *cb_syncKonsole; TQCheckBox *cb_useInstance; TQCheckBox *cb_sortFiles; diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp index 1a021beb9..1e0a4b37d 100644 --- a/kate/app/katemainwindow.cpp +++ b/kate/app/katemainwindow.cpp @@ -423,8 +423,9 @@ void KateMainWindow::readOptions () TDEConfig *config = KateApp::self()->config (); config->setGroup("General"); - syncKonsole = config->readBoolEntry("Sync Konsole", true); - useInstance = config->readBoolEntry("UseInstance", false); + showSessionName = config->readBoolEntry("Show session name", false); + syncKonsole = config->readBoolEntry("Sync Konsole", true); + useInstance = config->readBoolEntry("UseInstance", false); modNotification = config->readBoolEntry("Modified Notification", false); KateDocManager::self()->setSaveMetaInfos(config->readBoolEntry("Save Meta Infos", true)); KateDocManager::self()->setDaysMetaInfos(config->readNumEntry("Days Meta Infos", 30)); @@ -447,6 +448,7 @@ void KateMainWindow::saveOptions () else config->writeEntry("Show Console", false); + config->writeEntry("Show session name", showSessionName); config->writeEntry("Save Meta Infos", KateDocManager::self()->getSaveMetaInfos()); config->writeEntry("Days Meta Infos", KateDocManager::self()->getDaysMetaInfos()); config->writeEntry("Show Full Path in Title", m_viewManager->getShowFullPath()); @@ -820,7 +822,7 @@ void KateMainWindow::slotNameChanged(Kate::Document *doc) fileOpenRecent->addURL(doc->url()); } -void KateMainWindow::updateCaption (Kate::Document *doc) +void KateMainWindow::updateCaption(Kate::Document *doc) { if (!m_viewManager->activeView()) { @@ -841,12 +843,20 @@ void KateMainWindow::updateCaption (Kate::Document *doc) c = m_viewManager->activeView()->getDoc()->url().prettyURL(); } - TQString sessName = KateApp::self()->sessionManager()->getActiveSessionName(); - if ( !sessName.isEmpty() ) - sessName = TQString("%1: ").arg( sessName ); - - setCaption( sessName + KStringHandler::lsqueeze(c,64), - m_viewManager->activeView()->getDoc()->isModified()); + if (showSessionName) + { + TQString sessName = KateApp::self()->sessionManager()->getActiveSessionName(); + if (!sessName.isEmpty()) + { + sessName = TQString("%1: ").arg(sessName); + } + setCaption(KStringHandler::lsqueeze(sessName,32) + KStringHandler::lsqueeze(c,64), + m_viewManager->activeView()->getDoc()->isModified()); + } + else + { + setCaption(KStringHandler::lsqueeze(c,64), m_viewManager->activeView()->getDoc()->isModified()); + } } void KateMainWindow::saveProperties(TDEConfig *config) diff --git a/kate/app/katemainwindow.h b/kate/app/katemainwindow.h index aa2a6cee7..48f4129d6 100644 --- a/kate/app/katemainwindow.h +++ b/kate/app/katemainwindow.h @@ -187,6 +187,7 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa Kate::MainWindow *m_mainWindow; Kate::ToolViewManager *m_toolViewManager; + bool showSessionName; bool syncKonsole; bool useInstance; bool modNotification; |