[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-04 11:51:56
Message-ID: 1212580316.524003.1862.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 816632 by dfaure:
Continue cleaning up the menus of "konqueror as a webbrowser" : moved "Tools / Open \
Terminal" action to DolphinPart. Thanks to Kevin for reminding me of this one.
M +46 -2 dolphin/src/dolphinpart.cpp
M +5 -0 dolphin/src/dolphinpart.h
M +2 -1 dolphin/src/dolphinpart.rc
M +1 -7 konqueror/src/konq-filemanagement.rc
M +1 -6 konqueror/src/konq-simplebrowser.rc
M +2 -8 konqueror/src/konq-webbrowsing.rc
M +8 -53 konqueror/src/konqmainwindow.cpp
M +0 -1 konqueror/src/konqmainwindow.h
M +0 -10 konqueror/src/konqueror.kcfg
M +1 -7 konqueror/src/konqueror.rc
M +1 -1 konqueror/src/tests/konqviewmgrtest.cpp
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.cpp #816631:816632
@@ -38,6 +38,9 @@
#include <kpluginfactory.h>
#include <kpropertiesdialog.h>
#include <ktoggleaction.h>
+#include <kio/netaccess.h>
+#include <kauthorized.h>
+#include <kshell.h>
#include <QActionGroup>
#include <QApplication>
@@ -164,6 +167,16 @@
createGoAction("go_autostart", "",
i18nc("@action:inmenu Go", "Autostart"), \
KGlobalSettings::autostartPath(), goActionGroup);
+
+ // Tools menu
+ if (KAuthorized::authorizeKAction("shell_access")) {
+ KAction* action = actionCollection()->addAction("open_terminal");
+ action->setIcon(KIcon("utilities-terminal"));
+ action->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
+ connect(action, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
+ action->setShortcut(Qt::Key_F4);
+ }
+
}
void DolphinPart::createGoAction(const char* name, const char* iconName,
@@ -208,7 +221,7 @@
KonqFileItemCapabilities capabilities(selection);
const bool enableMoveToTrash = capabilities.isLocal() && \
capabilities.supportsMoving();
-
+
renameAction->setEnabled(capabilities.supportsMoving());
moveToTrashAction->setEnabled(enableMoveToTrash);
deleteAction->setEnabled(capabilities.supportsDeleting());
@@ -336,7 +349,7 @@
sDeleting = false;
sMoving = false;
}
-
+
if ( sMoving )
editActions.append(actionCollection()->action("rename"));
@@ -458,4 +471,35 @@
// TODO save/restore name filter in saveState/restoreState like KonqDirPart did \
in kde3? }
+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());
+
+ // If the given directory is not local, it can still be the URL of an
+ // ioslave using UDS_LOCAL_PATH which to be converted first.
+ u = KIO::NetAccess::mostLocalUrl(u, widget());
+
+ //If the URL is local after the above conversion, set the directory.
+ if (u.isLocalFile()) {
+ 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);
+}
+
#include "dolphinpart.moc"
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.h #816631:816632
@@ -172,6 +172,11 @@
*/
void slotProperties();
+ /**
+ * Open a terminal window, starting with the current directory.
+ */
+ void slotOpenTerminal();
+
private:
void createActions();
void createGoAction(const char* name, const char* iconName,
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.rc #816631:816632
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="dolphinpart" version="6" >
+<kpartgui name="dolphinpart" version="7" >
<MenuBar>
<Menu name="edit">
<Action name="rename"/>
@@ -50,6 +50,7 @@
<Action name="go_autostart"/>
</Menu>
<Menu name="tools">
+ <Action name="open_terminal"/>
<Action name="find_file" />
<Action name="show_filter_bar" />
<Action name="compare_files" />
--- trunk/KDE/kdebase/apps/konqueror/src/konq-filemanagement.rc #816631:816632
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="65">
+<gui name="Konqueror" version="66">
<MenuBar>
<Menu name="file" noMerge="1"><text>&File</text>
<Action name="new_window"/>
@@ -53,12 +53,6 @@
<Action name="closedtabs"/>
</Menu>
<Action name="bookmarks"/>
- <Menu name="tools"><text>&Tools</text>
- <Action name="open_terminal"/>
- <Action name="findfile"/>
- <WeakSeparator/>
- <Merge/>
- </Menu>
<Menu name="settings" noMerge="1"><text>&Settings</text>
<Merge name="StandardToolBarMenuHandler" />
<Action name="options_show_menubar"/>
--- trunk/KDE/kdebase/apps/konqueror/src/konq-simplebrowser.rc #816631:816632
@@ -1,7 +1,7 @@
<?xml version = '1.0'?>
<!-- This file is used by the simplebrowser profile -->
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui version="53" name="Konqueror" >
+<gui name="Konqueror" version="56">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&Location</text>
@@ -36,11 +36,6 @@
<Merge/>
</Menu>
<Action name="bookmarks" />
- <Menu name="tools" >
- <text>&Tools</text>
- <WeakSeparator/>
- <Merge/>
- </Menu>
<Menu noMerge="1" name="settings" >
<text>&Settings</text>
<Merge name="StandardToolBarMenuHandler" />
--- trunk/KDE/kdebase/apps/konqueror/src/konq-webbrowsing.rc #816631:816632
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="65">
+<gui name="Konqueror" version="66">
<MenuBar>
<Menu name="file" noMerge="1"><text>&File</text>
<Action name="new_window"/>
@@ -17,7 +17,7 @@
<Action name="print"/>
<DefineGroup name="print" />
<Separator/>
- <ActionList name="openwithbase" />
+ <ActionList name="openwithbase"/>
<ActionList name="openwith" /> <!--Includes termination separator-->
<Action name="quit"/>
</Menu>
@@ -55,12 +55,6 @@
<Action name="closedtabs"/>
</Menu>
<Action name="bookmarks"/>
- <Menu name="tools"><text>&Tools</text>
- <Action name="open_terminal"/>
- <Action name="findfile"/>
- <WeakSeparator/>
- <Merge/>
- </Menu>
<Menu name="settings" noMerge="1"><text>&Settings</text>
<Merge name="StandardToolBarMenuHandler" />
<Action name="options_show_menubar"/>
--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.cpp #816631:816632
@@ -123,7 +123,6 @@
#include <kiconloader.h>
#include <kmenu.h>
#include <kprocess.h>
-#include <kshell.h>
#include <kio/scheduler.h>
#include <kio/netaccess.h>
#include <kacceleratormanager.h>
@@ -283,14 +282,6 @@
m_toggleViewGUIClient = 0;
}
- // Those menus are created by konqueror.rc so their address will never change
- QMenu *popup = static_cast<QMenu*>(factory()->container("edit",this));
- if (popup)
- KAcceleratorManager::manage(popup);
- popup = static_cast<QMenu*>(factory()->container("tools",this));
- if (popup)
- KAcceleratorManager::manage(popup);
-
m_bHTMLAllowed = KonqSettings::htmlAllowed();
m_ptaUseHTML->setChecked( m_bHTMLAllowed );
@@ -399,6 +390,14 @@
}
}
+ if (res && element.tagName() == QLatin1String("Menu")) {
+ const QString& menuName = element.attribute("name");
+ if (menuName == "edit" || menuName == "tools") {
+ Q_ASSERT(qobject_cast<QMenu*>(res));
+ KAcceleratorManager::manage(static_cast<QMenu *>(res));
+ }
+ }
+
return res;
}
@@ -1419,42 +1418,6 @@
urls); // attachments
}
-void KonqMainWindow::slotOpenTerminal()
-{
- QString term = KonqSettings::terminalApplication();
-
- QString dir ( QDir::homePath() );
-
- //Try to get the directory of the current view
- if ( m_currentView )
- {
- KUrl u( m_currentView->url() );
-
- // If the given directory is not local, it can still be the URL of an
- // ioslave using UDS_LOCAL_PATH which to be converted first.
- u = KIO::NetAccess::mostLocalUrl(u, this);
-
- //If the URL is local after the above conversion, set the directory.
- if ( u.isLocalFile() )
- {
- if ( m_currentView->supportsMimeType( "inode/directory" ) )
- dir = u.path();
- else
- dir = u.directory();
- }
- }
-
- // Compensate for terminal having arguments.
- QStringList args = KShell::splitArgs(term);
- if(args.count() == 0)
- return;
- QString prog = args.takeFirst();
-
- QProcess::startDetached(prog, args, dir, NULL);
-
- kDebug(1202) << "directory" << dir << ", terminal:" << term;
-}
-
void KonqMainWindow::slotOpenLocation()
{
focusLocationBar();
@@ -3489,14 +3452,6 @@
action->setIcon(KIcon("mail-message-new"));
action->setText(i18n( "S&end File..." ));
connect(action, SIGNAL(triggered()), SLOT( slotSendFile() ));
- if (KAuthorized::authorizeKAction("shell_access"))
- {
- action = actionCollection()->addAction("open_terminal");
- action->setIcon(KIcon("utilities-terminal"));
- action->setText(i18n( "Open &Terminal" ));
- connect(action, SIGNAL(triggered()), SLOT( slotOpenTerminal() ));
- action->setShortcut(Qt::Key_F4);
- }
action = actionCollection()->addAction("open_location");
action->setIcon(KIcon("document-open-remote"));
action->setText(i18n( "&Open Location" ));
--- trunk/KDE/kdebase/apps/konqueror/src/konqmainwindow.h #816631:816632
@@ -353,7 +353,6 @@
void slotSendFile();
void slotCopyFiles();
void slotMoveFiles();
- void slotOpenTerminal();
void slotOpenLocation();
void slotOpenFile();
--- trunk/KDE/kdebase/apps/konqueror/src/konqueror.kcfg #816631:816632
@@ -529,16 +529,6 @@
</entry>
</group>
- <group name="General" >
-<!-- konqmainwindow.cpp, setting comes from kdeglobals, set by componentchooser kcm \
-->
- <entry key="TerminalApplication" type="String">
- <default>konsole</default>
- <label></label>
- <whatsthis></whatsthis>
- <!-- checked -->
- </entry>
- </group>
-
<group name="SessionManagerSettings">
<!-- konqsessionmanager.cpp -->
<entry key="AutoSaveInterval" type="Int">
--- trunk/KDE/kdebase/apps/konqueror/src/konqueror.rc #816631:816632
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="Konqueror" version="65">
+<gui name="Konqueror" version="66">
<MenuBar>
<Menu name="file" noMerge="1"><text>&File</text>
<Action name="new_window"/>
@@ -53,12 +53,6 @@
<Action name="closedtabs"/>
</Menu>
<Action name="bookmarks"/>
- <Menu name="tools"><text>&Tools</text>
- <Action name="open_terminal"/>
- <Action name="findfile"/>
- <WeakSeparator/>
- <Merge/>
- </Menu>
<Menu name="settings" noMerge="1"><text>&Settings</text>
<Merge name="StandardToolBarMenuHandler" />
<Action name="options_show_menubar"/>
--- trunk/KDE/kdebase/apps/konqueror/src/tests/konqviewmgrtest.cpp #816631:816632
@@ -198,7 +198,7 @@
QVERIFY( frame->height() > 240 ); // usually 325, but can be 256 with oxygen \
when three toolbars are shown //qDebug() << "view2 geom:" << frame2->geometry();
QVERIFY( frame2->width() > 300 && frame2->width() < 400 ); // horiz split, so \
half the mainWindow width
- QVERIFY( frame->height() > 240 ); // usually 325, but can be 256 with oxygen \
when three toolbars are shown + QVERIFY( frame2->height() > 240 ); // usually 325, \
but can be 256 with oxygen when three toolbars are shown
// Both frames should have the same size; well, if the width was odd then there \
can be an off-by-one... QCOMPARE( frame->height(), frame2->height() );
QVERIFY( qAbs(frame->width() - frame2->width()) <= 1 ); // e.g. 173 and 172 are \
"close enough"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic