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

List:       kde-commits
Subject:    KDE/kdebase/apps
From:       David Faure <faure () kde ! org>
Date:       2008-06-05 19:19:15
Message-ID: 1212693555.318486.9812.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 817326 by dfaure:

Move the "Create New" action (for the Edit menu, not for the context menu) to \
dolphinpart, so that it doesn't appear while browsing the web [with a filemanagement \
profile initially]. The point is to make the GUI sensible whatever initial profile \
was selected and hopefully get rid of konq-filemanagement.rc/konq-webbrowsing.rc.


 M  +18 -15    dolphin/src/dolphinpart.cpp  
 M  +7 -0      dolphin/src/dolphinpart.h  
 M  +3 -1      dolphin/src/dolphinpart.rc  
 M  +1 -3      konqueror/src/konq-filemanagement.rc  
 M  +3 -18     konqueror/src/konqmainwindow.cpp  
 M  +0 -1      konqueror/src/konqmainwindow.h  
 M  +1 -3      konqueror/src/konqueror.rc  


--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.cpp #817325:817326
@@ -39,8 +39,10 @@
 #include <kpropertiesdialog.h>
 #include <ktoggleaction.h>
 #include <kio/netaccess.h>
+#include <ktoolinvocation.h>
 #include <kauthorized.h>
-#include <kshell.h>
+#include <knewmenu.h>
+#include <kmenu.h>
 
 #include <QActionGroup>
 #include <QApplication>
@@ -135,6 +137,12 @@
 
 void DolphinPart::createActions()
 {
+    // Edit menu
+
+    m_newMenu = new KNewMenu(actionCollection(), widget(), "new_menu");
+    connect(m_newMenu->menu(), SIGNAL(aboutToShow()),
+            this, SLOT(updateNewMenu()));
+
     KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
     editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) \
                );
     connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
@@ -473,9 +481,6 @@
 
 void DolphinPart::slotOpenTerminal()
 {
-    KConfigGroup confGroup(KGlobal::config(), "General"); // set by componentchooser \
                kcm
-    const QString preferredTerminal = confGroup.readPathEntry("TerminalApplication", \
                "konsole");
-
     QString dir(QDir::homePath());
 
     KUrl u(url());
@@ -489,17 +494,15 @@
         dir = u.path();
     }
 
-    // Compensate for terminal having arguments.
-    QStringList args = KShell::splitArgs(preferredTerminal);
-    if (args.isEmpty()) {
-        return;
-    }
-    const QString prog = args.takeFirst();
-    if (prog == "konsole") {
-        args << "--workdir";
-        args << dir;
-    }
-    QProcess::startDetached(prog, args);
+    KToolInvocation::invokeTerminal(QString(), dir);
 }
 
+void DolphinPart::updateNewMenu()
+{
+    // As requested by KNewMenu :
+    m_newMenu->slotCheckUpToDate();
+    // And set the files that the menu apply on :
+    m_newMenu->setPopupFiles(url());
+}
+
 #include "dolphinpart.moc"
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.h #817325:817326
@@ -22,6 +22,7 @@
 
 #include <kparts/part.h>
 #include <kparts/browserextension.h>
+class KNewMenu;
 class DolphinViewActionHandler;
 class QActionGroup;
 class KAction;
@@ -177,6 +178,11 @@
      */
     void slotOpenTerminal();
 
+    /**
+     * Updates the 'Create New...' sub menu, just before it's shown.
+     */
+    void updateNewMenu();
+
 private:
     void createActions();
     void createGoAction(const char* name, const char* iconName,
@@ -190,6 +196,7 @@
     DolphinModel* m_dolphinModel;
     DolphinSortFilterProxyModel* m_proxyModel;
     DolphinPartBrowserExtension* m_extension;
+    KNewMenu* m_newMenu;
     QString m_nameFilter;
     Q_DISABLE_COPY(DolphinPart)
 };
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.rc #817325:817326
@@ -1,7 +1,9 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="dolphinpart" version="7" >
+<kpartgui name="dolphinpart" version="8" >
  <MenuBar>
   <Menu name="edit">
+   <Action name="new_menu"/>
+   <Separator/>
    <Action name="rename"/>
    <Action name="move_to_trash" />
    <Action name="delete"/>
--- trunk/KDE/kdebase/apps/konqueror/src/konq-filemanagement.rc #817325:817326
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="66">
+<gui name="Konqueror" version="67">
 <MenuBar>
  <Menu name="file" noMerge="1"><text>&amp;File</text>
   <Action name="new_window"/>
@@ -27,8 +27,6 @@
   <Action name="copy"/>
   <Action name="paste"/>
   <ActionList name="operations" /><!-- copy files and move files, when two directory \
                views -->
-  <Separator/>
-  <Action name="new_menu"/>
   <WeakSeparator/>
   <Merge/>
  </Menu>
--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.cpp #817325:817326
@@ -2026,7 +2026,6 @@
   updateViewActions(); // undo, lock, link and other view-dependent actions
   updateViewModeActions();
 
-  m_pMenuNew->setEnabled(m_currentView->showsDirectory());
   m_paHome->setIcon(KIcon(m_currentView->showsDirectory() ? "user-home" : \
"go-home"));  
   m_currentView->frame()->statusbar()->updateActiveStatus();
@@ -2262,14 +2261,6 @@
     m_bURLEnterLock = false;
 }
 
-void KonqMainWindow::slotFileNewAboutToShow()
-{
-  // As requested by KNewMenu :
-  m_pMenuNew->slotCheckUpToDate();
-  // And set the files that the menu apply on :
-  m_pMenuNew->setPopupFiles( m_currentView->url() );
-}
-
 void KonqMainWindow::slotSplitViewHorizontal()
 {
     if ( !m_currentView )
@@ -3421,10 +3412,10 @@
   // They are all disabled then re-enabled with enableAllActions
   // If any one needs to be initially disabled, put that code in enableAllActions
 
+  // For the popup menu only.
+  m_pMenuNew = new KNewMenu(actionCollection(), this, "new_menu");
+
   // File menu
-  m_pMenuNew = new KNewMenu ( actionCollection(), this, "new_menu" );
-  QObject::connect( m_pMenuNew->menu(), SIGNAL(aboutToShow()),
-                    this, SLOT(slotFileNewAboutToShow()) );
 
   KAction* action = actionCollection()->addAction("new_window");
   action->setIcon(KIcon("window-new"));
@@ -4223,7 +4214,6 @@
     m_paBack->setEnabled( false );
     m_paForward->setEnabled( false );
     m_ptaUseHTML->setEnabled( false );
-    m_pMenuNew->setEnabled( false );
     m_paLockView->setEnabled( false );
     m_paLockView->setChecked( false );
     m_paSplitViewVer->setEnabled( false );
@@ -4596,8 +4586,6 @@
                           this, SLOT(slotItemsRemoved(const KFileItemList &)) );
     }
 
-  QObject::disconnect( m_pMenuNew->menu(), SIGNAL(aboutToShow()),
-                       this, SLOT(slotFileNewAboutToShow()) );
 
   QPointer<QObject> guard( this ); // #149736, window could be deleted inside \
popupmenu event loop  pPopupMenu->exec( global );
@@ -4615,9 +4603,6 @@
   if ( guard.isNull() ) // the placement of this test is very important, \
double-check #149736 if moving stuff around  return;
 
-  QObject::connect( m_pMenuNew->menu(), SIGNAL(aboutToShow()),
-                       this, SLOT(slotFileNewAboutToShow()) );
-
   if (be) {
     QObject::disconnect( be, SIGNAL(itemsRemoved(const KFileItemList &)),
                          this, SLOT(slotItemsRemoved(const KFileItemList &)) );
--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.h #817325:817326
@@ -410,7 +410,6 @@
 
   void slotURLEntered(const QString &text, Qt::KeyboardModifiers);
 
-  void slotFileNewAboutToShow();
   void slotLocationLabelActivated();
 
   void slotDuplicateTab();
--- trunk/KDE/kdebase/apps/konqueror/src/konqueror.rc #817325:817326
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="66">
+<gui name="Konqueror" version="67">
 <MenuBar>
  <Menu name="file" noMerge="1"><text>&amp;File</text>
   <Action name="new_window"/>
@@ -27,8 +27,6 @@
   <Action name="copy"/>
   <Action name="paste"/>
   <ActionList name="operations" /><!-- copy files and move files, when two directory \
                views -->
-  <Separator/>
-  <Action name="new_menu"/>
   <WeakSeparator/>
   <Merge/>
  </Menu>


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

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