[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kate
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2005-04-17 21:39:33
Message-ID: 20050417213933.D79E4488 () office ! kde ! org
[Download RAW message or body]

CVS commit by cullmann: 

quick open sessions submenu


  M +9 -6      app/katemainwindow.cpp   1.293
  M +31 -0     app/katesession.cpp   1.30
  M +15 -0     app/katesession.h   1.18
  M +2 -1      data/kateui.rc   1.90


--- kdebase/kate/app/katemainwindow.cpp  #1.292:1.293
@@ -136,5 +136,5 @@ KateMainWindow::KateMainWindow () :
     Kate::Document::registerCommand(KateExternalToolsCommand::self());
 
-  // connect settings menu aboutToshow
+  // connect documents menu aboutToshow
   documentMenu = (QPopupMenu*)factory()->container("documents", this);
   connect(documentMenu, SIGNAL(aboutToShow()), this, \
SLOT(documentMenuAboutToShow())); @@ -271,9 +271,12 @@ void \
KateMainWindow::setupActions()  
   // session actions
-  a=new KAction(i18n("&New"), "filenew", 0, KateSessionManager::self(), \
                SLOT(sessionNew()), actionCollection(), "sessions_new");
-  a=new KAction(i18n("&Open..."), "fileopen", 0, KateSessionManager::self(), \
                SLOT(sessionOpen()), actionCollection(), "sessions_open");
-  a=new KAction(i18n("&Save"), "filesave", 0, KateSessionManager::self(), \
                SLOT(sessionSave()), actionCollection(), "sessions_save");
-  a=new KAction(i18n("Save &As..."), "filesaveas", 0, KateSessionManager::self(), \
                SLOT(sessionSaveAs()), actionCollection(), "sessions_save_as");
-  a=new KAction(i18n("&Manage..."), "view_choose", 0, KateSessionManager::self(), \
SLOT(sessionManage()), actionCollection(), "sessions_manage"); +  new \
KAction(i18n("&New"), "filenew", 0, KateSessionManager::self(), SLOT(sessionNew()), \
actionCollection(), "sessions_new"); +  new KAction(i18n("&Open..."), "fileopen", 0, \
KateSessionManager::self(), SLOT(sessionOpen()), actionCollection(), \
"sessions_open"); +  new KAction(i18n("&Save"), "filesave", 0, \
KateSessionManager::self(), SLOT(sessionSave()), actionCollection(), \
"sessions_save"); +  new KAction(i18n("Save &As..."), "filesaveas", 0, \
KateSessionManager::self(), SLOT(sessionSaveAs()), actionCollection(), \
"sessions_save_as"); +  new KAction(i18n("&Manage..."), "view_choose", 0, \
KateSessionManager::self(), SLOT(sessionManage()), actionCollection(), \
"sessions_manage"); +
+  // quick open menu ;)
+  new KateSessionsAction (i18n("&Quick Open"), actionCollection(), "sessions_list");
 }
 

--- kdebase/kate/app/katesession.cpp  #1.29:1.30
@@ -796,2 +796,33 @@ void KateSessionManageDialog::updateSess
 
 //END MANAGE DIALOG
+
+
+KateSessionsAction::KateSessionsAction(const QString& text, QObject* parent, const \
char* name ) +  : KActionMenu(text, parent, name)
+{
+  connect(popupMenu(),SIGNAL(aboutToShow()),this,SLOT(slotAboutToShow()));
+}
+
+void KateSessionsAction::slotAboutToShow()
+{
+  popupMenu()->clear ();
+
+  KateSessionList &slist (KateSessionManager::self()->sessionList());
+  for (unsigned int i=0; i < slist.count(); ++i)
+  {
+      popupMenu()->insertItem (
+          slist[i]->sessionName(),
+          this, SLOT (openSession (int)), 0,
+          i );
+  }
+}
+
+void KateSessionsAction::openSession (int i)
+{
+  KateSessionList &slist (KateSessionManager::self()->sessionList());
+
+  if ((uint)i >= slist.count())
+    return;
+
+  KateSessionManager::self()->activateSession(slist[(uint)i]);
+}

--- kdebase/kate/app/katesession.h  #1.17:1.18
@@ -25,4 +25,5 @@
 #include <ksimpleconfig.h>
 #include <ksharedptr.h>
+#include <kaction.h>
 
 #include <qobject.h>
@@ -393,3 +394,17 @@ class KateSessionManageDialog : public K
 };
 
+class KateSessionsAction : public KActionMenu
+{
+  Q_OBJECT
+
+  public:
+    KateSessionsAction(const QString& text, QObject* parent = 0, const char* name = \
0); +    ~KateSessionsAction (){;};
+
+  public  slots:
+    void slotAboutToShow();
+
+    void openSession (int i);
+};
+
 #endif

--- kdebase/kate/data/kateui.rc  #1.89:1.90
@@ -1,4 +1,4 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="kate" version="43">
+<kpartgui name="kate" version="45">
 
 <MenuBar noMerge="1">
@@ -64,4 +64,5 @@
     <Action name="sessions_new"/>
     <Action name="sessions_open"/>
+    <Action name="sessions_list"/>
     <Separator />
     <Action name="sessions_save"/>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic