[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Jan 7 21:19:00 CET 2005


CVS commit by arwalker: 

Fix problems with the Open Recent menu.

The opened file is now selected in the Open Recent menu even when it is opened from the QuckStart dialog.
No file is selected in the Open Recent menu following a Close request.


  M +21 -0     kst.cpp   1.274
  M +2 -1      kst.h   1.120
  M +4 -0      kstquickstartdialog_i.cpp   1.8


--- kdeextragear-2/kst/kst/kst.cpp  #1.273:1.274
@@ -770,4 +770,24 @@ void KstApp::addRecentFile(const KURL& u
 
 
+void KstApp::selectRecentFile(const KURL &url) {
+  QStringList urls;
+  int count;
+  int i;
+  
+  if (url.isEmpty()) {
+    recent->setCurrentItem(-1);
+  } else {
+    urls = recent->items();
+    count = urls.count();
+    for (i=0; i<count; i++) {
+      if (KURL(urls[i]) == url) {
+        recent->setCurrentItem(i);
+        break;
+      }
+    }
+  }
+}
+
+
 void KstApp::doDelayedOpens() {
   QValueList<KstOpen> queueCopy = QDeepCopy<QValueList<KstOpen> >(_openQueue);
@@ -918,4 +938,5 @@ void KstApp::slotFileNew() {
     doc->newDocument();
     setCaption(doc->title());
+    selectRecentFile(KURL(""));
   }
 

--- kdeextragear-2/kst/kst/kst.h  #1.119:1.120
@@ -91,4 +91,5 @@ class KstApp : public KMdiMainFrm {
     /** add a file to the recent file list */
     void addRecentFile(const KURL &file);
+    void selectRecentFile(const KURL &file);
 
     /** opens a file specified by commandline option */

--- kdeextragear-2/kst/kst/kstquickstartdialog_i.cpp  #1.7:1.8
@@ -55,4 +55,8 @@ void KstQuickStartDialogI::open_I() {
   if (_isRecentFile) {
     if (_app->slotFileOpenRecent(_fileName->url())) {
+      //
+      // select the recently opened file...
+      //
+      _app->selectRecentFile(_fileName->url());
       close();
     }




More information about the Kst mailing list