summaryrefslogtreecommitdiffstats
path: root/redhat/tdebase/kdebase-3.5.13-kate_focus_fix.patch
blob: 589341f2902e07b68a5e3b45a6151c2728dd0302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
--- kdebase.o/kate/app/kateconfigdialog.cpp.orig	2012-04-01 18:22:50.732901887 +0200
+++ kdebase/kate/app/kateconfigdialog.cpp	2012-04-01 18:25:01.100327408 +0200
@@ -138,6 +138,16 @@
   TQWhatsThis::add( sb_numRecentFiles, youwouldnotbelieveit );
   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 +171,7 @@
            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 +419,7 @@
     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);
 
diff -urN tdebase/kate/app/kateconfigdialog.h tdebase.new/kate/app/kateconfigdialog.h
--- tdebase/kate/app/kateconfigdialog.h	2012-01-08 18:00:01.000000000 -0600
+++ tdebase.new/kate/app/kateconfigdialog.h	2012-03-11 00:05:03.000000000 -0600
@@ -66,6 +66,7 @@
 
     TQCheckBox *cb_fullPath;
     TQCheckBox *cb_syncKonsole;
+    TQCheckBox *cb_useInstance;
     TQCheckBox *cb_sortFiles;
     TQSpinBox *sb_numRecentFiles;
     TQCheckBox *cb_modNotifications;
diff -urN tdebase/kate/app/katemain.cpp tdebase.new/kate/app/katemain.cpp
--- tdebase/kate/app/katemain.cpp	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemain.cpp	2012-03-11 00:05:03.000000000 -0600
@@ -41,6 +41,8 @@
     { "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,9 +59,13 @@
 
 extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
 {
+  KConfig * config = NULL;
+  bool alwaysUseInstance;
   // here we go, construct the Kate version
   TQString kateVersion = KateApp::kateVersion();
 
+  KInstance instance( "kate" );
+
   KAboutData aboutData ("kate", I18N_NOOP("Kate"), kateVersion.latin1(),
                         I18N_NOOP( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
                         I18N_NOOP( "(c) 2000-2005 The Kate Authors" ), 0, "http://kate.kde.org");
@@ -107,8 +113,13 @@
   // get our command line args ;)
   KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
 
-  // now, first try to contact running kate instance if needed
-  if ( args->isSet("use") || (::getenv("KATE_PID")!=0) )
+  config = KGlobal::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 -urN tdebase/kate/app/katemainwindow.cpp tdebase.new/kate/app/katemainwindow.cpp
--- tdebase/kate/app/katemainwindow.cpp	2012-01-08 18:00:01.000000000 -0600
+++ tdebase.new/kate/app/katemainwindow.cpp	2012-03-11 01:18:48.000000000 -0600
@@ -406,6 +406,7 @@
 
   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 @@
 
   config->writeEntry("Sync Konsole", syncKonsole);
 
+  config->writeEntry("UseInstance", useInstance);
+
   fileOpenRecent->saveEntries(config, "Recent Files");
 
   fileselector->writeConfig(config, "fileselector");
diff -urN tdebase/kate/app/katemainwindow.h tdebase.new/kate/app/katemainwindow.h
--- tdebase/kate/app/katemainwindow.h	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemainwindow.h	2012-03-11 00:05:03.000000000 -0600
@@ -182,6 +182,7 @@
     Kate::ToolViewManager *m_toolViewManager;
 
     bool syncKonsole;
+    bool useInstance;
     bool modNotification;
 
     DCOPObject *m_dcop;
diff -urN tdebase/kate/app/katemain.cpp tdebase.new/kate/app/katemain.cpp
--- tdebase/kate/app/katemain.cpp	2011-12-25 00:52:38.000000000 -0600
+++ tdebase.new/kate/app/katemain.cpp	2012-03-11 13:32:05.000000000 -0500
@@ -231,7 +231,9 @@
         else
           wRef.call("restore");
       }
+      wRef.call( "hide" );
       wRef.call( "raise" );
+      wRef.call( "show" );
 
       // stop startup notification
       KStartupInfo::appStarted(  );