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

List:       kde-commits
Subject:    extragear/office/skrooge
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2010-08-30 21:10:18
Message-ID: 20100830211018.683E9AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1170143 by smankowski:

Better middle click mngt forcontext & bookmark


 M  +13 -7     skg_bookmark/skgbookmarkplugin.cpp  
 M  +1 -1      skg_bookmark/skgbookmarkplugin.h  
 M  +1 -1      skgbankmodeler/skgdocumentbank.h  
 M  +19 -7     skgbasegui/skgmainpanel.cpp  
 M  +1 -1      skgbasegui/skgmainpanel.h  
 M  +1 -1      skgbasemodeler/skgdocument.h  


--- trunk/extragear/office/skrooge/skg_bookmark/skgbookmarkplugin.cpp \
#1170142:1170143 @@ -96,7 +96,7 @@
 
     //Bookmark
     bookmarkAction = new KToolBarPopupAction ( KIcon ( "bookmark-new-list" ), i18nc \
                ( "Verb, action to display bookmarks", "Bookmarks" ), this );
-    connect ( bookmarkAction, SIGNAL ( triggered ( bool ) ), this, SLOT ( \
actionOpenBookmark() ) ); +    connect ( bookmarkAction, SIGNAL ( \
triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT ( actionOpenBookmark() \
                ) );
     actionCollection()->addAction ( QLatin1String ( "edit_bookmark" ), \
bookmarkAction );  bookmarkMenu= static_cast<KMenu*>(bookmarkAction->menu());
     if (bookmarkMenu)
@@ -237,20 +237,20 @@
 
 }
 
-void SKGBookmarkPlugin::actionOpenBookmark()
+void SKGBookmarkPlugin::actionOpenBookmark(Qt::MouseButtons iMouse, \
Qt::KeyboardModifiers iKeyboard)  {
     QAction* callerAction=dynamic_cast<QAction*>(this->sender());
     if ( callerAction ) {
         QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
         SKGNodeObject node(currentDocument, callerAction->data().toInt());
-        SKGBookmarkPluginDockWidget::openBookmark(node);
+        SKGBookmarkPluginDockWidget::openBookmark(node, iMouse&Qt::MiddleButton || \
iKeyboard&Qt::ControlModifier);  QApplication::restoreOverrideCursor();
     }
 }
 
 void SKGBookmarkPlugin::onShowBookmarkMenu()
 {
-    QMenu* callerMenu=dynamic_cast<QMenu*>(this->sender());
+    KMenu* callerMenu=dynamic_cast<KMenu*>(this->sender());
     if ( callerMenu ) {
         //Remove previous menu
         callerMenu->clear();
@@ -269,9 +269,12 @@
             if (node.isFolder())
             {
                 //This is a folder
-                KMenu* menu=static_cast<KMenu*>(callerMenu->addMenu (node.getIcon(), \
node.getName())); +                KMenu* menu=new KMenu(callerMenu);
                 if (menu)
                 {
+                    callerMenu->addMenu(menu);
+                    menu->setTitle(node.getName());
+                    menu->setIcon(node.getIcon());
                     menu->setProperty ("id", node.getID() );
                     connect ( menu , SIGNAL ( aboutToShow() ), this, SLOT ( \
onShowBookmarkMenu() ) );  }
@@ -279,10 +282,13 @@
             else
             {
                 //This is a bookmark
-                QAction* act=callerMenu->addAction (node.getIcon(), node.getName());
+                KAction* act=new KAction(callerMenu);
                 if ( act ) {
+                    callerMenu->addAction(act);
+                    act->setText(node.getName());
+                    act->setIcon(node.getIcon());
                     act->setData ( node.getID() );
-                    connect ( act, SIGNAL ( triggered() ), this, SLOT ( \
actionOpenBookmark() ) ); +                    connect ( act, SIGNAL ( \
triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT ( \
actionOpenBookmark(Qt::MouseButtons,Qt::KeyboardModifiers) ) );  }
             }
         }
--- trunk/extragear/office/skrooge/skg_bookmark/skgbookmarkplugin.h #1170142:1170143
@@ -97,7 +97,7 @@
     void importStandardBookmarks();
     void goHome();
 
-    void actionOpenBookmark();
+    void actionOpenBookmark(Qt::MouseButtons iMouse=Qt::LeftButton, \
Qt::KeyboardModifiers iKeyboard=Qt::NoModifier);  void onShowBookmarkMenu();
 
 private:
--- trunk/extragear/office/skrooge/skgbankmodeler/skgdocumentbank.h #1170142:1170143
@@ -35,7 +35,7 @@
 class SKGBANKMODELER_EXPORT SKGDocumentBank : public SKGDocument
 {
     Q_OBJECT;
-    Q_CLASSINFO("D-Bus Interface", "org.skrooge.SKGDocumentBank")
+    Q_CLASSINFO("D-Bus Interface", "org.skrooge.SKGDocumentBank");
 
 public:
     /**
--- trunk/extragear/office/skrooge/skgbasegui/skgmainpanel.cpp #1170142:1170143
@@ -71,7 +71,7 @@
         currentDocument ( iDocument ),
         tipOfDayAction ( NULL ),closePageAction ( NULL ), closeAllPagesAction ( NULL \
                ), closeAllOtherPagesAction ( NULL ),
         fullScreenAction (NULL), kSystemTrayIcon ( NULL ), kNormalMessage ( NULL ),  \
                previousAction ( NULL ), nextAction ( NULL ),
-        saveOnClose(false)
+        middleClick(false), saveOnClose(false)
 {
     SKGTRACEIN ( 1, "SKGMainPanel::SKGMainPanel" );
 
@@ -223,10 +223,21 @@
     statusBar()->show();
 
     //Add action to control hide / display of Context Chooser
-    ui.kDockContext->toggleViewAction()->setText ( i18nc ("Noun", "Context Chooser" \
                ) );
-    ui.kDockContext->toggleViewAction()->setShortcut ( Qt::SHIFT+Qt::Key_F9 );
-    actionCollection()->addAction ( "view_context", \
ui.kDockContext->toggleViewAction() ); +    /*KAction* toggle = \
actionCollection()->addAction("view_context"); +    \
toggle->setShortcut(QKeySequence(Qt::SHIFT+Qt::Key_F9)); +    toggle->setText(i18nc \
("Noun", "Context Chooser" ) ); +    toggle->setCheckable(true);
+    toggle->setChecked(true);
+    connect(toggle, SIGNAL(toggled(bool)), ui.kDockContext->toggleViewAction(), \
SLOT(toggle())); +    connect(ui.kDockContext, SIGNAL(visibilityChanged(bool)), \
toggle, SLOT(setChecked(bool)));*/  
+    QAction* toggle=ui.kDockContext->toggleViewAction();
+    if (toggle)
+    {
+        toggle->setText ( i18nc ("Noun", "Context Chooser" ) );
+        toggle->setShortcut ( Qt::SHIFT+Qt::Key_F9 );
+        actionCollection()->addAction ( "view_context", toggle );
+    }
     KSelectAction* contextMenu = new KSelectAction ( KIcon ( "tab-new" ), i18nc \
("Noun", "Context" ), this );  actionCollection()->addAction ( "view_contextmenu" , \
contextMenu );  
@@ -275,7 +286,7 @@
                             }
                             if ( !shortCutPrefix.isEmpty() ) action->setShortcut ( \
shortCutPrefix+SKGServices::intToString ( shortCutIndex ) );  }
-                        connect ( action, SIGNAL ( triggered ( bool ) ), this, SLOT \
( onOpenContext() ) ); +                        connect ( action, SIGNAL ( \
triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT ( \
onOpenContext(Qt::MouseButtons,Qt::KeyboardModifiers) ) );  
                         contextActionList.append(action);
                     }
@@ -1267,7 +1278,7 @@
     QApplication::restoreOverrideCursor();
 }
 
-void SKGMainPanel::onOpenContext ()
+void SKGMainPanel::onOpenContext (Qt::MouseButtons iMouse, Qt::KeyboardModifiers \
iKeyboard)  {
     SKGTRACEIN ( 1, "SKGMainPanel::onOpenContext" );
     QApplication::setOverrideCursor ( QCursor ( Qt::WaitCursor ) );
@@ -1275,7 +1286,8 @@
     QAction* sender=dynamic_cast<QAction*> ( this->sender() );
     if ( sender ) page=sender->data().toInt();
     else page=ui.kContextList->currentRow ();
-    if ( page!=-1 ) openPage(page, sender || QApplication::keyboardModifiers() \
&Qt::ControlModifier || middleClick); +    if ( page!=-1 ) openPage(page, \
QApplication::keyboardModifiers() &Qt::ControlModifier || middleClick || \
iMouse&Qt::MiddleButton || iKeyboard&Qt::ControlModifier); +    middleClick=false;
     QApplication::restoreOverrideCursor();
 }
 
--- trunk/extragear/office/skrooge/skgbasegui/skgmainpanel.h #1170142:1170143
@@ -317,7 +317,7 @@
 
     void addTab();
     void onBeforeOpenContext();
-    void onOpenContext();
+    void onOpenContext(Qt::MouseButtons iMouse=Qt::LeftButton, Qt::KeyboardModifiers \
iKeyboard=Qt::NoModifier);  void onTipOfDay();
     void onTrayActivated ( QSystemTrayIcon::ActivationReason reason );
     void saveDefaultState();
--- trunk/extragear/office/skrooge/skgbasemodeler/skgdocument.h #1170142:1170143
@@ -41,7 +41,7 @@
 class SKGBASEMODELER_EXPORT SKGDocument : public QObject
 {
     Q_OBJECT;
-    Q_CLASSINFO("D-Bus Interface", "org.skg.SKGDocument")
+    Q_CLASSINFO("D-Bus Interface", "org.skg.SKGDocument");
 
     /**
      * This enumerate defines a type of modification


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

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