CCMAIL: faure@kde.org
svn path=/trunk/KDE/kdebase/apps/; revision=764347
#include <kmenu.h>
#include <kmenubar.h>
#include <kmessagebox.h>
#include <kmenu.h>
#include <kmenubar.h>
#include <kmessagebox.h>
-#include <konq_operations.h>
#include <konqmimedata.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
#include <konqmimedata.h>
#include <kpropertiesdialog.h>
#include <kprotocolinfo.h>
-void DolphinMainWindow::createDir()
-{
- const KUrl& url = m_activeViewContainer->view()->url();
- KonqOperations::newDir(this, url);
-}
-
void DolphinMainWindow::updateNewMenu()
{
m_newMenu->slotCheckUpToDate();
void DolphinMainWindow::updateNewMenu()
{
m_newMenu->slotCheckUpToDate();
connect(menu, SIGNAL(aboutToShow()),
this, SLOT(updateNewMenu()));
connect(menu, SIGNAL(aboutToShow()),
this, SLOT(updateNewMenu()));
- // This action doesn't appear in the GUI, it's for the shortcut only.
- // KNewMenu takes care of the GUI stuff.
- KAction* newDirAction = actionCollection()->addAction("create_dir");
- newDirAction->setText(i18n("Create Folder..."));
- connect(newDirAction, SIGNAL(triggered()), SLOT(createDir()));
- newDirAction->setShortcut(Qt::Key_F10);
-
KAction* newWindow = actionCollection()->addAction("new_window");
newWindow->setIcon(KIcon("window-new"));
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
KAction* newWindow = actionCollection()->addAction("new_window");
newWindow->setIcon(KIcon("window-new"));
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
virtual void readProperties(const KConfigGroup& group);
private slots:
virtual void readProperties(const KConfigGroup& group);
private slots:
- /** Opens the dialog for creating a directory. */
- void createDir();
-
/** Updates the 'Create New...' sub menu. */
void updateNewMenu();
/** Updates the 'Create New...' sub menu. */
void updateNewMenu();
KUrl(),
m_dirLister,
m_dolphinModel,
KUrl(),
m_dirLister,
m_dolphinModel,
+ m_proxyModel,
+ actionCollection());
setWidget(m_view);
setXMLFile("dolphinpart.rc");
setWidget(m_view);
setXMLFile("dolphinpart.rc");
propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return);
connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return);
connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
- // This action doesn't appear in the GUI, it's for the shortcut only.
- // KNewMenu takes care of the GUI stuff.
- KAction* newDirAction = actionCollection()->addAction( "create_dir" );
- newDirAction->setText( i18n("Create Folder..." ) );
- connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir()));
- newDirAction->setShortcut(Qt::Key_F10);
- widget()->addAction(newDirAction);
-
// Go menu
QActionGroup* goActionGroup = new QActionGroup(this);
// Go menu
QActionGroup* goActionGroup = new QActionGroup(this);
m_view->trashSelectedItems();
}
m_view->trashSelectedItems();
}
-void DolphinPart::slotNewDir()
-{
- KonqOperations::newDir(widget(), url());
-}
-
void DolphinPart::slotEditMimeType()
{
const KFileItemList items = m_view->selectedItems();
void DolphinPart::slotEditMimeType()
{
const KFileItemList items = m_view->selectedItems();
*/
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
*/
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
- /**
- * Connected to the key shortcut for "new directory" (F10)
- */
- void slotNewDir();
-
/**
* Connected to all "Go" menu actions provided by DolphinPart
*/
/**
* Connected to all "Go" menu actions provided by DolphinPart
*/
const KUrl& url,
KDirLister* dirLister,
DolphinModel* dolphinModel,
const KUrl& url,
KDirLister* dirLister,
DolphinModel* dolphinModel,
- DolphinSortFilterProxyModel* proxyModel) :
+ DolphinSortFilterProxyModel* proxyModel,
+ KActionCollection* actionCollection) :
QWidget(parent),
m_active(true),
m_showPreview(false),
QWidget(parent),
m_active(true),
m_showPreview(false),
applyViewProperties(url);
m_topLayout->addWidget(itemView());
applyViewProperties(url);
m_topLayout->addWidget(itemView());
+
+ Q_ASSERT(actionCollection != 0);
+ if (actionCollection->action("create_dir") == 0) {
+ // This action doesn't appear in the GUI, it's for the shortcut only.
+ // KNewMenu takes care of the GUI stuff.
+ KAction* newDirAction = actionCollection->addAction("create_dir");
+ newDirAction->setText(i18n("Create Folder..."));
+ connect(newDirAction, SIGNAL(triggered()), SLOT(createDir()));
+ newDirAction->setShortcut(Qt::Key_F10);
+ }
}
DolphinView::~DolphinView()
}
DolphinView::~DolphinView()
+void DolphinView::createDir()
+{
+ KonqOperations::newDir(this, url());
+}
+
void DolphinView::cutSelectedItems()
{
QMimeData* mimeData = new QMimeData();
void DolphinView::cutSelectedItems()
{
QMimeData* mimeData = new QMimeData();
class DolphinSortFilterProxyModel;
class IconManager;
class KAction;
class DolphinSortFilterProxyModel;
class IconManager;
class KAction;
+class KActionCollection;
class KDirLister;
class KFileItemDelegate;
class KUrl;
class KDirLister;
class KFileItemDelegate;
class KUrl;
- * @param parent Parent widget of the view.
- * @param url Specifies the content which should be shown.
- * @param dirLister Used directory lister. The lister is not owned
- * by the view and won't get deleted.
- * @param dolphinModel Used directory model. The model is not owned
- * by the view and won't get deleted.
- * @param proxyModel Used proxy model which specifies the sorting. The
- * model is not owned by the view and won't get
- * deleted.
+ * @param parent Parent widget of the view.
+ * @param url Specifies the content which should be shown.
+ * @param dirLister Used directory lister. The lister is not owned
+ * by the view and won't get deleted.
+ * @param dolphinModel Used directory model. The model is not owned
+ * by the view and won't get deleted.
+ * @param proxyModel Used proxy model which specifies the sorting. The
+ * model is not owned by the view and won't get
+ * deleted.
+ * @param actionCollection Action collection which contains the menu actions.
*/
DolphinView(QWidget* parent,
const KUrl& url,
KDirLister* dirLister,
DolphinModel* dolphinModel,
*/
DolphinView(QWidget* parent,
const KUrl& url,
KDirLister* dirLister,
DolphinModel* dolphinModel,
- DolphinSortFilterProxyModel* proxyModel);
+ DolphinSortFilterProxyModel* proxyModel,
+ KActionCollection* actionCollection);
*/
void slotDeleteFileFinished(KJob* job);
*/
void slotDeleteFileFinished(KJob* job);
+ /**
+ * Opens the dialog for creating a directory. Is connected
+ * with the key shortcut for "new directory" (F10).
+ */
+ void createDir();
+
private:
void loadDirectory(const KUrl& url, bool reload = false);
private:
void loadDirectory(const KUrl& url, bool reload = false);
url,
m_dirLister,
m_dolphinModel,
url,
m_dirLister,
m_dolphinModel,
+ m_proxyModel,
+ mainWindow->actionCollection());
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),