summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2013-08-17 14:45:11 -0500
committerDarrell Anderson <[email protected]>2013-08-17 14:45:11 -0500
commitf3db9433f8b18683e192c97835d15c26f19b96a0 (patch)
tree6e20c9772d410294f5e68d6a844bebc9c57c0b71
parent82958c52cc4e119f0f7dbbd6740a4491d383c9aa (diff)
downloadtdebase-f3db9433f8b18683e192c97835d15c26f19b96a0.tar.gz
tdebase-f3db9433f8b18683e192c97835d15c26f19b96a0.zip
Add the ability to force Kate into MDI mode all the time.
This resolves bug report 1127.
-rw-r--r--kate/app/kateconfigdialog.cpp12
-rw-r--r--kate/app/kateconfigdialog.h1
-rw-r--r--kate/app/katemain.cpp15
-rw-r--r--kate/app/katemainwindow.cpp3
-rw-r--r--kate/app/katemainwindow.h1
5 files changed, 29 insertions, 3 deletions
diff --git a/kate/app/kateconfigdialog.cpp b/kate/app/kateconfigdialog.cpp
index 76809241e..697e46644 100644
--- a/kate/app/kateconfigdialog.cpp
+++ b/kate/app/kateconfigdialog.cpp
@@ -138,6 +138,15 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view )
TQWhatsThis::add( sb_numRecentFiles, numRecentFileHelpString );
connect( sb_numRecentFiles, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) );
+ // Use only one instance of kate (MDI) ?
+ cb_useInstance = new TQCheckBox(bgStartup);
+ cb_useInstance->setText(i18n("Always use the current instance of kate to open new files"));
+ cb_useInstance->setChecked(parent->useInstance);
+ TQWhatsThis::add( cb_useInstance, i18n(
+ "When checked, all files opened from outside of Kate will only use the "
+ "currently opened instance of Kate.") );
+ connect( cb_useInstance, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
+
// sync the konsole ?
cb_syncKonsole = new TQCheckBox(bgStartup);
cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
@@ -161,7 +170,7 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view )
this, TQT_SLOT( slotChanged() ) );
// GROUP with the one below: "Meta-informations"
- bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("Meta-Information"), frGeneral );
+ bgStartup = new TQButtonGroup( 2, Qt::Horizontal, i18n("Meta-Information"), frGeneral );
lo->addWidget( bgStartup );
// save meta infos
@@ -409,6 +418,7 @@ void KateConfigDialog::slotApply()
mainWindow->modNotification = cb_modNotifications->isChecked();
mainWindow->syncKonsole = cb_syncKonsole->isChecked();
+ mainWindow->useInstance = cb_useInstance->isChecked();
mainWindow->filelist->setSortType(cb_sortFiles->isChecked() ? KateFileList::sortByName : KateFileList::sortByID);
config->writeEntry( "Number of recent files", sb_numRecentFiles->value() );
diff --git a/kate/app/kateconfigdialog.h b/kate/app/kateconfigdialog.h
index 8704753ab..5bbfc526d 100644
--- a/kate/app/kateconfigdialog.h
+++ b/kate/app/kateconfigdialog.h
@@ -66,6 +66,7 @@ class KateConfigDialog : public KDialogBase
TQCheckBox *cb_fullPath;
TQCheckBox *cb_syncKonsole;
+ TQCheckBox *cb_useInstance;
TQCheckBox *cb_sortFiles;
TQSpinBox *sb_numRecentFiles;
TQCheckBox *cb_modNotifications;
diff --git a/kate/app/katemain.cpp b/kate/app/katemain.cpp
index bc46d5402..7b9903d5e 100644
--- a/kate/app/katemain.cpp
+++ b/kate/app/katemain.cpp
@@ -41,6 +41,8 @@ static TDECmdLineOptions options[] =
{ "start <name>", I18N_NOOP("Start Kate with a given session"), 0 },
{ "u", 0, 0 },
{ "use", I18N_NOOP("Use a already running kate instance (if possible)"), 0 },
+ { "f", 0, 0 },
+ { "force-sdi", I18N_NOOP("Force single document mode if the MDI setting is enabled."), 0 },
{ "p", 0, 0 },
{ "pid <pid>", I18N_NOOP("Only try to reuse kate instance with this pid"), 0 },
{ "e", 0, 0 },
@@ -57,6 +59,8 @@ static TDECmdLineOptions options[] =
extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
{
+ TDEConfig * config = NULL;
+ bool alwaysUseInstance;
// here we go, construct the Kate version
TQString kateVersion = KateApp::kateVersion();
@@ -98,6 +102,8 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
aboutData.setTranslator(I18N_NOOP2("NAME OF TRANSLATORS","Your names"), I18N_NOOP2("EMAIL OF TRANSLATORS","Your emails"));
+ TDEInstance instance( &aboutData );
+
// command line args init and co
TDECmdLineArgs::init (argc, argv, &aboutData);
TDECmdLineArgs::addCmdLineOptions (options);
@@ -107,8 +113,13 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
// get our command line args ;)
TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs();
- // now, first try to contact running kate instance if needed
- if ( args->isSet("use") || (::getenv("KATE_PID")!=0) )
+ config = TDEGlobal::config();
+ config->setGroup("General");
+ alwaysUseInstance = config->readBoolEntry("UseInstance");
+
+// now, first try to contact running kate instance if needed
+ if ( ((args->isSet("use") || alwaysUseInstance) &&
+ !(args->isSet("force-sdi"))) || (::getenv("KATE_PID")!=0) )
{
DCOPClient client;
client.attach ();
diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp
index cf62e77f1..ada436a07 100644
--- a/kate/app/katemainwindow.cpp
+++ b/kate/app/katemainwindow.cpp
@@ -406,6 +406,7 @@ void KateMainWindow::readOptions ()
config->setGroup("General");
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));
@@ -437,6 +438,8 @@ void KateMainWindow::saveOptions ()
config->writeEntry("Sync Konsole", syncKonsole);
+ config->writeEntry("UseInstance", useInstance);
+
fileOpenRecent->saveEntries(config, "Recent Files");
fileselector->writeConfig(config, "fileselector");
diff --git a/kate/app/katemainwindow.h b/kate/app/katemainwindow.h
index 30582ed3e..eb2891819 100644
--- a/kate/app/katemainwindow.h
+++ b/kate/app/katemainwindow.h
@@ -182,6 +182,7 @@ class KateMainWindow : public KateMDI::MainWindow, virtual public KParts::PartBa
Kate::ToolViewManager *m_toolViewManager;
bool syncKonsole;
+ bool useInstance;
bool modNotification;
DCOPObject *m_dcop;