mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Deprecated KNewMenu and make it derive from KNewFileMenu (BIC, but SC; the only way to avoid duplicating code until kde5)
Port all of kdebase' use of KNewMenu to KNewFileMenu. Also port from KonqNameAndUrlInputDialog to KNameAndUrlInputDialog, and from KonqMenuActions to KFileItemActions in dolphincontextmenu.cpp svn path=/trunk/KDE/kdebase/apps/; revision=1080547
This commit is contained in:
parent
950d3ad78b
commit
ad85be955b
|
@ -41,7 +41,7 @@
|
|||
#include <knewmenu.h>
|
||||
#include <konqmimedata.h>
|
||||
#include <konq_operations.h>
|
||||
#include <konq_menuactions.h>
|
||||
#include <kfileitemactions.h>
|
||||
#include <klocale.h>
|
||||
#include <kpropertiesdialog.h>
|
||||
#include <krun.h>
|
||||
|
@ -191,7 +191,7 @@ void DolphinContextMenu::openItemContextMenu()
|
|||
DolphinNewMenu* newMenu = new DolphinNewMenu(popup, m_mainWindow);
|
||||
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
|
||||
newMenu->setViewShowsHiddenFiles(view->showHiddenFiles());
|
||||
newMenu->slotCheckUpToDate();
|
||||
newMenu->checkUpToDate();
|
||||
newMenu->setPopupFiles(m_fileInfo.url());
|
||||
newMenu->setEnabled(capabilities().supportsWriting());
|
||||
|
||||
|
@ -222,7 +222,7 @@ void DolphinContextMenu::openItemContextMenu()
|
|||
}
|
||||
}
|
||||
|
||||
KonqMenuActions menuActions;
|
||||
KFileItemActions menuActions;
|
||||
menuActions.setParentWidget(m_mainWindow);
|
||||
menuActions.setItemListProperties(m_selectedItems);
|
||||
|
||||
|
@ -230,7 +230,7 @@ void DolphinContextMenu::openItemContextMenu()
|
|||
menuActions.addOpenWithActionsTo(popup, "DesktopEntryName != 'dolphin'");
|
||||
|
||||
// insert 'Actions' sub menu
|
||||
if (menuActions.addActionsTo(popup)) {
|
||||
if (menuActions.addServiceActionsTo(popup)) {
|
||||
popup->addSeparator();
|
||||
}
|
||||
|
||||
|
@ -269,10 +269,10 @@ void DolphinContextMenu::openViewportContextMenu()
|
|||
addShowMenubarAction(popup);
|
||||
|
||||
// setup 'Create New' menu
|
||||
KNewMenu* newMenu = m_mainWindow->newMenu();
|
||||
KNewFileMenu* newMenu = m_mainWindow->newMenu();
|
||||
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
|
||||
newMenu->setViewShowsHiddenFiles(view->showHiddenFiles());
|
||||
newMenu->slotCheckUpToDate();
|
||||
newMenu->checkUpToDate();
|
||||
newMenu->setPopupFiles(m_baseUrl);
|
||||
popup->addMenu(newMenu->menu());
|
||||
popup->addSeparator();
|
||||
|
|
|
@ -632,7 +632,7 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
|
|||
void DolphinMainWindow::updateNewMenu()
|
||||
{
|
||||
m_newMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
|
||||
m_newMenu->slotCheckUpToDate();
|
||||
m_newMenu->checkUpToDate();
|
||||
m_newMenu->setPopupFiles(activeViewContainer()->url());
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class DolphinSearchOptionsConfigurator;
|
|||
class DolphinSettingsDialog;
|
||||
class DolphinViewContainer;
|
||||
class DolphinRemoteEncoding;
|
||||
class KNewMenu;
|
||||
class KNewFileMenu;
|
||||
class KTabBar;
|
||||
class KUrl;
|
||||
class QSplitter;
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
* Returns the 'Create New...' sub menu which also can be shared
|
||||
* with other menus (e. g. a context menu).
|
||||
*/
|
||||
KNewMenu* newMenu() const;
|
||||
KNewFileMenu* newMenu() const;
|
||||
|
||||
/**
|
||||
* Returns the 'Show Menubar' action which can be shared with
|
||||
|
@ -522,7 +522,7 @@ private:
|
|||
virtual void jobError(KIO::Job* job);
|
||||
};
|
||||
|
||||
KNewMenu* m_newMenu;
|
||||
KNewFileMenu* m_newMenu;
|
||||
KActionMenu* m_recentTabsMenu;
|
||||
KAction* m_showMenuBar;
|
||||
KTabBar* m_tabBar;
|
||||
|
@ -561,7 +561,7 @@ inline bool DolphinMainWindow::isSplit() const
|
|||
return m_viewTab[m_tabIndex].secondaryView != 0;
|
||||
}
|
||||
|
||||
inline KNewMenu* DolphinMainWindow::newMenu() const
|
||||
inline KNewFileMenu* DolphinMainWindow::newMenu() const
|
||||
{
|
||||
return m_newMenu;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <kio/job.h>
|
||||
|
||||
DolphinNewMenu::DolphinNewMenu(QWidget* parent, DolphinMainWindow* mainWin) :
|
||||
KNewMenu(mainWin->actionCollection(), parent, "create_new"),
|
||||
KNewFileMenu(mainWin->actionCollection(), "create_new", parent),
|
||||
m_mainWin(mainWin)
|
||||
{
|
||||
DolphinNewMenuObserver::instance().attach(this);
|
||||
|
@ -47,7 +47,7 @@ void DolphinNewMenu::slotResult(KJob* job)
|
|||
DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
|
||||
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
|
||||
} else {
|
||||
KNewMenu::slotResult(job);
|
||||
KNewFileMenu::slotResult(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ class KJob;
|
|||
* @brief Represents the 'Create New...' sub menu for the File menu
|
||||
* and the context menu.
|
||||
*
|
||||
* The only difference to KNewMenu is the custom error handling.
|
||||
* The only difference to KNewFileMenu is the custom error handling.
|
||||
* All errors are shown in the status bar of Dolphin
|
||||
* instead as modal error dialog with an OK button.
|
||||
*/
|
||||
class DolphinNewMenu : public KNewMenu
|
||||
class DolphinNewMenu : public KNewFileMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
virtual ~DolphinNewMenu();
|
||||
|
||||
protected slots:
|
||||
/** @see KNewMenu::slotResult() */
|
||||
/** @see KNewFileMenu::slotResult() */
|
||||
virtual void slotResult(KJob* job);
|
||||
|
||||
private:
|
||||
|
|
|
@ -34,13 +34,13 @@ DolphinNewMenuObserver& DolphinNewMenuObserver::instance()
|
|||
return s_dolphinNewMenuObserver->instance;
|
||||
}
|
||||
|
||||
void DolphinNewMenuObserver::attach(const KNewMenu* menu)
|
||||
void DolphinNewMenuObserver::attach(const KNewFileMenu* menu)
|
||||
{
|
||||
connect(menu, SIGNAL(itemCreated(const KUrl&)),
|
||||
this, SIGNAL(itemCreated(const KUrl&)));
|
||||
}
|
||||
|
||||
void DolphinNewMenuObserver::detach(const KNewMenu* menu)
|
||||
void DolphinNewMenuObserver::detach(const KNewFileMenu* menu)
|
||||
{
|
||||
disconnect(menu, SIGNAL(itemCreated(const KUrl&)),
|
||||
this, SIGNAL(itemCreated(const KUrl&)));
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "libdolphin_export.h"
|
||||
|
||||
class KNewMenu;
|
||||
class KNewFileMenu;
|
||||
class KUrl;
|
||||
|
||||
/**
|
||||
|
@ -40,8 +40,8 @@ class LIBDOLPHINPRIVATE_EXPORT DolphinNewMenuObserver : public QObject
|
|||
|
||||
public:
|
||||
static DolphinNewMenuObserver& instance();
|
||||
void attach(const KNewMenu* menu);
|
||||
void detach(const KNewMenu* menu);
|
||||
void attach(const KNewFileMenu* menu);
|
||||
void detach(const KNewFileMenu* menu);
|
||||
|
||||
signals:
|
||||
void itemCreated(const KUrl& url);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <kio/netaccess.h>
|
||||
#include <ktoolinvocation.h>
|
||||
#include <kauthorized.h>
|
||||
#include <knewmenu.h>
|
||||
#include <knewfilemenu.h>
|
||||
#include <kmenu.h>
|
||||
#include <kinputdialog.h>
|
||||
|
||||
|
@ -156,7 +156,7 @@ void DolphinPart::createActions()
|
|||
{
|
||||
// Edit menu
|
||||
|
||||
m_newMenu = new KNewMenu(actionCollection(), widget(), "new_menu");
|
||||
m_newMenu = new KNewFileMenu(actionCollection(), "new_menu", widget());
|
||||
DolphinNewMenuObserver::instance().attach(m_newMenu);
|
||||
connect(m_newMenu->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateNewMenu()));
|
||||
|
@ -601,8 +601,8 @@ void DolphinPart::slotOpenTerminal()
|
|||
|
||||
void DolphinPart::updateNewMenu()
|
||||
{
|
||||
// As requested by KNewMenu :
|
||||
m_newMenu->slotCheckUpToDate();
|
||||
// As requested by KNewFileMenu :
|
||||
m_newMenu->checkUpToDate();
|
||||
m_newMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
|
||||
// And set the files that the menu apply on :
|
||||
m_newMenu->setPopupFiles(url());
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <QItemSelectionModel>
|
||||
|
||||
class KNewMenu;
|
||||
class KNewFileMenu;
|
||||
class DolphinViewActionHandler;
|
||||
class QActionGroup;
|
||||
class KAction;
|
||||
|
@ -233,7 +233,7 @@ private:
|
|||
DolphinModel* m_dolphinModel;
|
||||
DolphinSortFilterProxyModel* m_proxyModel;
|
||||
DolphinPartBrowserExtension* m_extension;
|
||||
KNewMenu* m_newMenu;
|
||||
KNewFileMenu* m_newMenu;
|
||||
QString m_nameFilter;
|
||||
Q_DISABLE_COPY(DolphinPart)
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ DolphinView* DolphinViewActionHandler::currentView()
|
|||
void DolphinViewActionHandler::createActions()
|
||||
{
|
||||
// This action doesn't appear in the GUI, it's for the shortcut only.
|
||||
// KNewMenu takes care of the GUI stuff.
|
||||
// KNewFileMenu takes care of the GUI stuff.
|
||||
KAction* newDirAction = m_actionCollection->addAction("create_dir");
|
||||
newDirAction->setText(i18nc("@action", "Create Folder..."));
|
||||
newDirAction->setShortcut(Qt::Key_F10);
|
||||
|
|
|
@ -88,7 +88,7 @@ Q_SIGNALS:
|
|||
/**
|
||||
* Emitted if the user requested creating a new directory by the F10 key.
|
||||
* The receiver of the signal (DolphinMainWindow or DolphinPart) invokes
|
||||
* the method createDirectory of their KNewMenu instance.
|
||||
* the method createDirectory of their KNewFileMenu instance.
|
||||
*/
|
||||
void createDirectory();
|
||||
|
||||
|
|
Loading…
Reference in a new issue