2006-11-21 06:02:05 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
|
|
|
|
* Copyright (C) 2006 by Stefan Monov <logixoul@gmail.com> *
|
|
|
|
* Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
2006-12-08 21:24:08 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
2006-11-21 06:02:05 +00:00
|
|
|
***************************************************************************/
|
|
|
|
|
2007-03-15 19:51:48 +00:00
|
|
|
#ifndef DOLPHIN_MAINWINDOW_H
|
|
|
|
#define DOLPHIN_MAINWINDOW_H
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-01-18 06:32:21 +00:00
|
|
|
#include "dolphinview.h"
|
2009-01-14 20:14:36 +00:00
|
|
|
#include "panels/panel.h"
|
2007-01-18 06:32:21 +00:00
|
|
|
|
2007-06-22 10:18:46 +00:00
|
|
|
#include <config-nepomuk.h>
|
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
#include <kfileitemdelegate.h>
|
2008-04-30 23:32:33 +00:00
|
|
|
#include <kio/fileundomanager.h>
|
2007-10-02 22:04:36 +00:00
|
|
|
#include <ksortablelist.h>
|
|
|
|
#include <kxmlguiwindow.h>
|
2009-03-01 01:38:20 +00:00
|
|
|
#include <kactionmenu.h>
|
2006-12-08 23:41:08 +00:00
|
|
|
|
2007-05-09 22:23:52 +00:00
|
|
|
#include <QtCore/QList>
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2008-10-01 21:39:35 +00:00
|
|
|
typedef KIO::FileUndoManager::CommandType CommandType;
|
|
|
|
|
2008-02-13 18:45:20 +00:00
|
|
|
class KAction;
|
2008-02-11 12:34:48 +00:00
|
|
|
class DolphinViewActionHandler;
|
2007-03-15 19:51:48 +00:00
|
|
|
class DolphinApplication;
|
2009-01-19 14:25:08 +00:00
|
|
|
class DolphinSearchBox;
|
2009-10-17 19:24:05 +00:00
|
|
|
class DolphinSearchOptionsConfigurator;
|
2009-01-13 18:06:15 +00:00
|
|
|
class DolphinSettingsDialog;
|
2007-06-07 21:10:48 +00:00
|
|
|
class DolphinViewContainer;
|
2009-03-25 22:00:50 +00:00
|
|
|
class DolphinRemoteEncoding;
|
2007-01-25 16:56:52 +00:00
|
|
|
class KNewMenu;
|
2008-04-12 15:09:46 +00:00
|
|
|
class KTabBar;
|
2006-11-21 06:02:05 +00:00
|
|
|
class KUrl;
|
|
|
|
class QSplitter;
|
2010-01-20 11:26:39 +00:00
|
|
|
class KJob;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @short Main window for Dolphin.
|
|
|
|
*
|
|
|
|
* Handles the menus, toolbars and Dolphin views.
|
2007-02-18 17:01:36 +00:00
|
|
|
*/
|
2007-04-16 20:44:36 +00:00
|
|
|
class DolphinMainWindow: public KXmlGuiWindow
|
2006-11-21 06:02:05 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2007-02-18 17:01:36 +00:00
|
|
|
Q_CLASSINFO("D-Bus Interface", "org.kde.dolphin.MainWindow")
|
|
|
|
Q_PROPERTY(int id READ getId SCRIPTABLE true)
|
2006-11-29 00:02:19 +00:00
|
|
|
friend class DolphinApplication;
|
2007-02-18 17:01:36 +00:00
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
public:
|
2006-11-29 00:02:19 +00:00
|
|
|
virtual ~DolphinMainWindow();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
/**
|
2007-06-12 21:45:22 +00:00
|
|
|
* Returns the currently active view.
|
|
|
|
* All menu actions are applied to this view. When
|
|
|
|
* having a split view setup, the nonactive view
|
2007-06-07 21:10:48 +00:00
|
|
|
* is usually shown in darker colors.
|
|
|
|
*/
|
2007-09-27 12:44:14 +00:00
|
|
|
DolphinViewContainer* activeViewContainer() const;
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2009-12-17 21:07:18 +00:00
|
|
|
/**
|
|
|
|
* Opens each directory \p in a separate tab. If the "split view"
|
|
|
|
* option is enabled, 2 directories are collected within one tab.
|
|
|
|
*/
|
|
|
|
void openDirectories(const QList<KUrl>& dirs);
|
2010-01-20 11:26:39 +00:00
|
|
|
|
2009-12-17 21:07:18 +00:00
|
|
|
/**
|
|
|
|
* Opens the directory which contains the files \p files
|
|
|
|
* and selects all files (implements the --select option
|
|
|
|
* of Dolphin).
|
|
|
|
*/
|
|
|
|
void openFiles(const QList<KUrl>& files);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
2007-06-12 21:45:22 +00:00
|
|
|
* Returns true, if the main window contains two instances
|
|
|
|
* of a view container. The active view constainer can be
|
|
|
|
* accessed by DolphinMainWindow::activeViewContainer().
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2007-09-27 12:44:14 +00:00
|
|
|
bool isSplit() const;
|
2007-06-12 21:45:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the main window contains two instances of a view container
|
|
|
|
* (DolphinMainWindow::isSplit() returns true), then the
|
|
|
|
* two views get toggled (the right view is on the left, the left
|
|
|
|
* view on the right).
|
|
|
|
*/
|
|
|
|
void toggleViews();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-03-13 17:31:54 +00:00
|
|
|
/** Renames the item represented by \a oldUrl to \a newUrl. */
|
|
|
|
void rename(const KUrl& oldUrl, const KUrl& newUrl);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
2007-09-01 08:00:48 +00:00
|
|
|
* Refreshes the views of the main window by recreating them dependent from
|
2006-11-21 06:02:05 +00:00
|
|
|
* the given Dolphin settings.
|
|
|
|
*/
|
|
|
|
void refreshViews();
|
|
|
|
|
2007-01-25 16:56:52 +00:00
|
|
|
/**
|
|
|
|
* Returns the 'Create New...' sub menu which also can be shared
|
|
|
|
* with other menus (e. g. a context menu).
|
|
|
|
*/
|
2007-09-27 12:44:14 +00:00
|
|
|
KNewMenu* newMenu() const;
|
2007-01-25 16:56:52 +00:00
|
|
|
|
2007-11-18 14:37:57 +00:00
|
|
|
/**
|
|
|
|
* Returns the 'Show Menubar' action which can be shared with
|
|
|
|
* other menus (e. g. a context menu).
|
|
|
|
*/
|
|
|
|
KAction* showMenuBarAction() const;
|
|
|
|
|
2007-02-18 17:01:36 +00:00
|
|
|
public slots:
|
2008-03-29 14:54:56 +00:00
|
|
|
/**
|
|
|
|
* Pastes the clipboard data into the currently selected folder
|
|
|
|
* of the active view. If not exactly one folder is selected,
|
|
|
|
* no pasting is done at all.
|
|
|
|
*/
|
|
|
|
void pasteIntoFolder();
|
|
|
|
|
2007-02-18 17:01:36 +00:00
|
|
|
/**
|
2007-03-17 20:39:15 +00:00
|
|
|
* Returns the main window ID used through DBus.
|
2007-02-18 17:01:36 +00:00
|
|
|
*/
|
2007-09-27 12:44:14 +00:00
|
|
|
int getId() const;
|
2007-02-18 17:01:36 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-17 21:07:18 +00:00
|
|
|
* Implementation of the MainWindowAdaptor/QDBusAbstractAdaptor interface.
|
2009-01-14 20:14:36 +00:00
|
|
|
* Inform all affected dolphin components (panels, views) of an URL
|
2007-03-25 06:44:28 +00:00
|
|
|
* change.
|
|
|
|
*/
|
|
|
|
void changeUrl(const KUrl& url);
|
|
|
|
|
2007-02-18 17:01:36 +00:00
|
|
|
/** Stores all settings and quits Dolphin. */
|
|
|
|
void quit();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
signals:
|
|
|
|
/**
|
2007-03-25 06:44:28 +00:00
|
|
|
* Is sent if the selection of the currently active view has
|
2006-11-21 06:02:05 +00:00
|
|
|
* been changed.
|
|
|
|
*/
|
2007-10-02 19:03:03 +00:00
|
|
|
void selectionChanged(const KFileItemList& selection);
|
2007-03-25 06:44:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is sent if the url of the currently active view has
|
|
|
|
* been changed.
|
|
|
|
*/
|
|
|
|
void urlChanged(const KUrl& url);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-05-17 14:51:54 +00:00
|
|
|
/**
|
2009-01-14 20:14:36 +00:00
|
|
|
* Is emitted if information of an item is requested to be shown e. g. in the panel.
|
2007-07-02 17:24:54 +00:00
|
|
|
* If item is null, no item information request is pending.
|
2007-05-17 14:51:54 +00:00
|
|
|
*/
|
2007-07-02 17:24:54 +00:00
|
|
|
void requestItemInfo(const KFileItem& item);
|
2007-05-17 14:51:54 +00:00
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
protected:
|
2010-01-11 09:21:16 +00:00
|
|
|
/** @see QWidget::showEvent() */
|
|
|
|
virtual void showEvent(QShowEvent* event);
|
|
|
|
|
2007-11-30 18:42:17 +00:00
|
|
|
/** @see QMainWindow::closeEvent() */
|
2006-11-21 06:02:05 +00:00
|
|
|
virtual void closeEvent(QCloseEvent* event);
|
|
|
|
|
2007-11-30 18:42:17 +00:00
|
|
|
/** @see KMainWindow::saveProperties() */
|
|
|
|
virtual void saveProperties(KConfigGroup& group);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-11-30 18:42:17 +00:00
|
|
|
/** @see KMainWindow::readProperties() */
|
|
|
|
virtual void readProperties(const KConfigGroup& group);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
private slots:
|
2008-02-11 12:34:48 +00:00
|
|
|
void clearStatusBar();
|
2008-01-21 19:31:07 +00:00
|
|
|
|
2007-01-25 16:56:52 +00:00
|
|
|
/** Updates the 'Create New...' sub menu. */
|
|
|
|
void updateNewMenu();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2009-03-26 18:44:36 +00:00
|
|
|
void createDirectory();
|
|
|
|
|
2008-11-08 16:22:30 +00:00
|
|
|
/** Shows the error message in the status bar of the active view. */
|
|
|
|
void showErrorMessage(const QString& message);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
|
|
|
* Updates the state of the 'Undo' menu action dependent
|
|
|
|
* from the parameter \a available.
|
|
|
|
*/
|
|
|
|
void slotUndoAvailable(bool available);
|
|
|
|
|
2009-03-01 01:38:20 +00:00
|
|
|
/** Invoked when an action in the recent tabs menu is clicked. */
|
|
|
|
void restoreClosedTab(QAction* action);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/** Sets the text of the 'Undo' menu action to \a text. */
|
|
|
|
void slotUndoTextChanged(const QString& text);
|
|
|
|
|
2007-01-31 22:14:46 +00:00
|
|
|
/** Performs the current undo operation. */
|
|
|
|
void undo();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/**
|
|
|
|
* Copies all selected items to the clipboard and marks
|
2009-10-19 23:32:21 +00:00
|
|
|
* the items as cut.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
|
|
|
void cut();
|
|
|
|
|
|
|
|
/** Copies all selected items to the clipboard. */
|
|
|
|
void copy();
|
|
|
|
|
|
|
|
/** Pastes the clipboard data to the active view. */
|
|
|
|
void paste();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the text of the paste action dependent from
|
|
|
|
* the number of items which are in the clipboard.
|
|
|
|
*/
|
|
|
|
void updatePasteAction();
|
|
|
|
|
|
|
|
/** Selects all items from the active view. */
|
|
|
|
void selectAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inverts the selection of all items of the active view:
|
|
|
|
* Selected items get nonselected and nonselected items get
|
|
|
|
* selected.
|
|
|
|
*/
|
|
|
|
void invertSelection();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Switches between one and two views:
|
|
|
|
* If one view is visible, it will get split into two views.
|
|
|
|
* If already two views are visible, the nonactivated view gets closed.
|
|
|
|
*/
|
|
|
|
void toggleSplitView();
|
|
|
|
|
|
|
|
/** Reloads the current active view. */
|
|
|
|
void reloadView();
|
|
|
|
|
|
|
|
/** Stops the loading process for the current active view. */
|
|
|
|
void stopLoading();
|
|
|
|
|
|
|
|
/**
|
2008-01-28 11:37:08 +00:00
|
|
|
* Toggles between showing and hiding of the filter bar
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
2008-01-28 11:37:08 +00:00
|
|
|
void toggleFilterBarVisibility(bool show);
|
2006-11-21 06:02:05 +00:00
|
|
|
|
|
|
|
/**
|
2008-02-07 07:27:06 +00:00
|
|
|
* Toggles between edit and browse mode of the navigation bar.
|
2006-11-21 06:02:05 +00:00
|
|
|
*/
|
|
|
|
void toggleEditLocation();
|
|
|
|
|
|
|
|
/**
|
2008-10-25 09:41:39 +00:00
|
|
|
* Switches to the edit mode of the navigation bar and selects
|
|
|
|
* the whole URL, so that it can be replaced by the user. If the edit mode is
|
2006-11-21 06:02:05 +00:00
|
|
|
* already active, it is assured that the navigation bar get focused.
|
|
|
|
*/
|
2008-10-25 09:41:39 +00:00
|
|
|
void replaceLocation();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2007-03-13 17:31:54 +00:00
|
|
|
/** Goes back on step of the URL history. */
|
2006-11-21 06:02:05 +00:00
|
|
|
void goBack();
|
|
|
|
|
2007-03-13 17:31:54 +00:00
|
|
|
/** Goes forward one step of the URL history. */
|
2006-11-21 06:02:05 +00:00
|
|
|
void goForward();
|
|
|
|
|
2007-03-13 17:31:54 +00:00
|
|
|
/** Goes up one hierarchy of the current URL. */
|
2006-11-21 06:02:05 +00:00
|
|
|
void goUp();
|
|
|
|
|
2009-11-09 17:50:21 +00:00
|
|
|
/**
|
|
|
|
* Open the previous URL in the URL history in a new tab
|
|
|
|
* if the middle mouse button is clicked.
|
|
|
|
*/
|
|
|
|
void goBack(Qt::MouseButtons buttons);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the next URL in the URL history in a new tab
|
|
|
|
* if the middle mouse button is clicked.
|
|
|
|
*/
|
|
|
|
void goForward(Qt::MouseButtons buttons);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open the URL one hierarchy above the current URL in a new tab
|
|
|
|
* if the middle mouse button is clicked.
|
|
|
|
*/
|
|
|
|
void goUp(Qt::MouseButtons buttons);
|
|
|
|
|
2007-03-13 17:31:54 +00:00
|
|
|
/** Goes to the home URL. */
|
2006-11-21 06:02:05 +00:00
|
|
|
void goHome();
|
|
|
|
|
|
|
|
/** Opens Kompare for 2 selected files. */
|
|
|
|
void compareFiles();
|
|
|
|
|
2007-11-18 14:37:57 +00:00
|
|
|
/**
|
|
|
|
* Hides the menu bar if it is visible, makes the menu bar
|
|
|
|
* visible if it is hidden.
|
|
|
|
*/
|
|
|
|
void toggleShowMenuBar();
|
|
|
|
|
2009-03-10 06:59:27 +00:00
|
|
|
/** Opens a terminal window for the current location. */
|
|
|
|
void openTerminal();
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
/** Opens the settings dialog for Dolphin. */
|
|
|
|
void editSettings();
|
|
|
|
|
2008-02-07 07:27:06 +00:00
|
|
|
/** Updates the state of the 'Show Full Location' action. */
|
|
|
|
void slotEditableStateChanged(bool editable);
|
|
|
|
|
2007-05-17 14:51:54 +00:00
|
|
|
/**
|
|
|
|
* Updates the state of the 'Edit' menu actions and emits
|
|
|
|
* the signal selectionChanged().
|
|
|
|
*/
|
2007-10-02 19:03:03 +00:00
|
|
|
void slotSelectionChanged(const KFileItemList& selection);
|
2006-12-08 23:41:08 +00:00
|
|
|
|
2009-01-30 06:16:13 +00:00
|
|
|
/** Enables changing of tabs via mouse wheel. */
|
2009-01-30 06:13:11 +00:00
|
|
|
void slotWheelMoved(int wheelDelta);
|
2009-01-29 23:44:20 +00:00
|
|
|
|
2007-05-17 14:51:54 +00:00
|
|
|
/** Emits the signal requestItemInfo(). */
|
2007-07-02 17:24:54 +00:00
|
|
|
void slotRequestItemInfo(const KFileItem&);
|
2007-05-17 14:51:54 +00:00
|
|
|
|
2006-12-08 23:41:08 +00:00
|
|
|
/**
|
|
|
|
* Updates the state of the 'Back' and 'Forward' menu
|
2008-09-25 15:05:22 +00:00
|
|
|
* actions corresponding to the current history.
|
2006-12-08 23:41:08 +00:00
|
|
|
*/
|
2008-02-23 15:48:56 +00:00
|
|
|
void updateHistory();
|
2006-12-08 23:41:08 +00:00
|
|
|
|
|
|
|
/** Updates the state of the 'Show filter bar' menu action. */
|
|
|
|
void updateFilterBarAction(bool show);
|
|
|
|
|
|
|
|
/** Open a new main window. */
|
|
|
|
void openNewMainWindow();
|
2006-11-21 06:02:05 +00:00
|
|
|
|
2008-04-12 16:12:57 +00:00
|
|
|
/** Opens a new view with the current URL that is part of a tab. */
|
2008-04-12 15:09:46 +00:00
|
|
|
void openNewTab();
|
|
|
|
|
2008-04-12 16:12:57 +00:00
|
|
|
/**
|
|
|
|
* Opens a new tab showing the URL \a url.
|
|
|
|
*/
|
|
|
|
void openNewTab(const KUrl& url);
|
|
|
|
|
2008-10-25 09:00:28 +00:00
|
|
|
void activateNextTab();
|
|
|
|
|
|
|
|
void activatePrevTab();
|
|
|
|
|
2008-10-25 10:32:55 +00:00
|
|
|
/**
|
|
|
|
* Opens the selected folder in a new tab.
|
|
|
|
*/
|
|
|
|
void openInNewTab();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the selected folder in a new window.
|
|
|
|
*/
|
|
|
|
void openInNewWindow();
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
/** Toggles the active view if two views are shown within the main window. */
|
|
|
|
void toggleActiveView();
|
|
|
|
|
2008-10-01 21:39:35 +00:00
|
|
|
/**
|
|
|
|
* Indicates in the statusbar that the execution of the command \a command
|
|
|
|
* has been finished.
|
|
|
|
*/
|
|
|
|
void showCommand(CommandType command);
|
2007-11-15 14:59:02 +00:00
|
|
|
|
2008-04-12 15:09:46 +00:00
|
|
|
/**
|
|
|
|
* Activates the tab with the index \a index, which means that the current view
|
|
|
|
* is replaced by the view of the given tab.
|
|
|
|
*/
|
|
|
|
void setActiveTab(int index);
|
|
|
|
|
2008-04-16 20:03:05 +00:00
|
|
|
/** Closes the currently active tab. */
|
|
|
|
void closeTab();
|
|
|
|
|
2008-04-13 20:20:30 +00:00
|
|
|
/**
|
|
|
|
* Closes the tab with the index \index and activates the tab with index - 1.
|
|
|
|
*/
|
|
|
|
void closeTab(int index);
|
|
|
|
|
2009-01-30 06:13:11 +00:00
|
|
|
|
2008-04-16 20:03:05 +00:00
|
|
|
/**
|
|
|
|
* Opens a context menu for the tab with the index \a index
|
|
|
|
* on the position \a pos.
|
|
|
|
*/
|
|
|
|
void openTabContextMenu(int index, const QPoint& pos);
|
|
|
|
|
2008-05-11 20:14:50 +00:00
|
|
|
/**
|
|
|
|
* Handles a click on a places item: if the middle mouse button is
|
|
|
|
* clicked, a new tab is opened for \a url, otherwise the current
|
|
|
|
* view is replaced by \a url.
|
|
|
|
*/
|
|
|
|
void handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons);
|
2008-12-12 06:55:26 +00:00
|
|
|
|
2008-08-12 19:22:38 +00:00
|
|
|
/**
|
2008-12-12 06:55:26 +00:00
|
|
|
* Is connected to the KTabBar signal testCanDecode() and adjusts
|
2008-08-12 19:22:38 +00:00
|
|
|
* the output parameter \a accept.
|
|
|
|
*/
|
|
|
|
void slotTestCanDecode(const QDragMoveEvent* event, bool& accept);
|
2008-05-11 20:14:50 +00:00
|
|
|
|
2009-01-19 13:17:33 +00:00
|
|
|
/**
|
2009-11-13 21:03:19 +00:00
|
|
|
* Is connected with the Dolphin search box and the search configurator
|
|
|
|
* and triggers a Nepomuk search.
|
2009-01-19 13:17:33 +00:00
|
|
|
*/
|
2009-11-13 21:03:19 +00:00
|
|
|
void searchItems();
|
2009-01-19 13:17:33 +00:00
|
|
|
|
2009-04-15 21:50:50 +00:00
|
|
|
/**
|
|
|
|
* Is connected to the QTabBar signal tabMoved(int from, int to).
|
|
|
|
* Reorders the list of tabs after a tab was moved in the tab bar
|
|
|
|
* and sets m_tabIndex to the new index of the current tab.
|
|
|
|
*/
|
|
|
|
void slotTabMoved(int from, int to);
|
|
|
|
|
2009-10-17 19:24:05 +00:00
|
|
|
/**
|
2009-11-10 21:44:24 +00:00
|
|
|
* Is connected to the searchbox signal 'requestSearchOptions' and
|
|
|
|
* takes care to show the search options.
|
2009-10-17 19:24:05 +00:00
|
|
|
*/
|
2009-11-10 21:44:24 +00:00
|
|
|
void showSearchOptions();
|
2009-10-17 19:24:05 +00:00
|
|
|
|
2009-11-25 20:53:37 +00:00
|
|
|
/**
|
|
|
|
* If the URL can be listed open it in the current view, otherwise
|
|
|
|
* run it through KRun.
|
|
|
|
*/
|
|
|
|
void handleUrl(const KUrl& url);
|
|
|
|
|
2010-01-20 11:26:39 +00:00
|
|
|
/**
|
|
|
|
* setUrlAsCaption will trigger a stat job which reports its result in
|
|
|
|
* this slot.
|
|
|
|
*/
|
|
|
|
void slotCaptionStatFinished( KJob* job );
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
private:
|
2007-02-18 17:01:36 +00:00
|
|
|
DolphinMainWindow(int id);
|
2006-11-21 06:02:05 +00:00
|
|
|
void init();
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
/**
|
|
|
|
* Activates the given view, which means that
|
|
|
|
* all menu actions are applied to this view. When
|
|
|
|
* having a split view setup, the nonactive view
|
|
|
|
* is usually shown in darker colors.
|
|
|
|
*/
|
|
|
|
void setActiveViewContainer(DolphinViewContainer* view);
|
|
|
|
|
2006-11-21 06:02:05 +00:00
|
|
|
void setupActions();
|
2006-11-29 18:09:26 +00:00
|
|
|
void setupDockWidgets();
|
2006-11-21 06:02:05 +00:00
|
|
|
void updateEditActions();
|
|
|
|
void updateViewActions();
|
|
|
|
void updateGoActions();
|
|
|
|
|
2009-03-01 01:38:20 +00:00
|
|
|
/**
|
|
|
|
* Adds the tab[\a index] to the closed tab menu's list of actions.
|
|
|
|
*/
|
|
|
|
void rememberClosedTab(int index);
|
|
|
|
|
2006-12-08 23:41:08 +00:00
|
|
|
/**
|
|
|
|
* Connects the signals from the created DolphinView with
|
2008-04-12 15:09:46 +00:00
|
|
|
* the DolphinViewContainer \a container with the corresponding slots of
|
2006-12-08 23:41:08 +00:00
|
|
|
* the DolphinMainWindow. This method must be invoked each
|
|
|
|
* time a DolphinView has been created.
|
|
|
|
*/
|
2008-04-12 15:09:46 +00:00
|
|
|
void connectViewSignals(DolphinViewContainer* container);
|
2007-03-25 06:44:28 +00:00
|
|
|
|
2007-06-03 14:07:45 +00:00
|
|
|
/**
|
|
|
|
* Updates the text of the split action:
|
2007-08-12 17:48:29 +00:00
|
|
|
* If two views are shown, the text is set to "Split",
|
2007-06-03 14:07:45 +00:00
|
|
|
* otherwise the text is set to "Join". The icon
|
2007-08-12 17:48:29 +00:00
|
|
|
* is updated to match with the text and the currently active view.
|
2007-06-03 14:07:45 +00:00
|
|
|
*/
|
2007-08-12 17:48:29 +00:00
|
|
|
void updateSplitAction();
|
2007-06-03 14:07:45 +00:00
|
|
|
|
2008-04-16 20:03:05 +00:00
|
|
|
/** Returns the name of the tab for the URL \a url. */
|
|
|
|
QString tabName(const KUrl& url) const;
|
|
|
|
|
2008-06-28 18:42:51 +00:00
|
|
|
bool isKompareInstalled() const;
|
|
|
|
|
2008-12-12 20:30:23 +00:00
|
|
|
void createSecondaryView(int tabIndex);
|
|
|
|
|
2009-03-19 07:23:41 +00:00
|
|
|
/**
|
|
|
|
* Helper method for saveProperties() and readProperties(): Returns
|
|
|
|
* the property string for a tab with the index \a tabIndex and
|
|
|
|
* the property \a property.
|
|
|
|
*/
|
|
|
|
QString tabProperty(const QString& property, int tabIndex) const;
|
|
|
|
|
2009-05-05 21:49:03 +00:00
|
|
|
/**
|
2009-11-25 20:53:37 +00:00
|
|
|
* Sets the window caption to url.fileName() if this is non-empty,
|
2009-05-05 21:49:03 +00:00
|
|
|
* "/" if the URL is "file:///", and url.protocol() otherwise.
|
|
|
|
*/
|
|
|
|
void setUrlAsCaption(const KUrl& url);
|
|
|
|
|
2009-07-10 06:07:32 +00:00
|
|
|
QString squeezedText(const QString& text) const;
|
|
|
|
|
2008-04-12 15:09:46 +00:00
|
|
|
private:
|
2007-01-25 19:37:19 +00:00
|
|
|
/**
|
|
|
|
* Implements a custom error handling for the undo manager. This
|
|
|
|
* assures that all errors are shown in the status bar of Dolphin
|
|
|
|
* instead as modal error dialog with an OK button.
|
|
|
|
*/
|
2008-04-30 23:32:33 +00:00
|
|
|
class UndoUiInterface : public KIO::FileUndoManager::UiInterface
|
2007-01-26 00:55:49 +00:00
|
|
|
{
|
2007-01-25 19:37:19 +00:00
|
|
|
public:
|
2008-04-20 22:07:44 +00:00
|
|
|
UndoUiInterface();
|
2007-01-25 19:37:19 +00:00
|
|
|
virtual ~UndoUiInterface();
|
|
|
|
virtual void jobError(KIO::Job* job);
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
2007-01-26 00:55:49 +00:00
|
|
|
|
|
|
|
KNewMenu* m_newMenu;
|
2009-03-01 01:38:20 +00:00
|
|
|
KActionMenu* m_recentTabsMenu;
|
2007-11-18 14:37:57 +00:00
|
|
|
KAction* m_showMenuBar;
|
2008-04-12 15:09:46 +00:00
|
|
|
KTabBar* m_tabBar;
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinViewContainer* m_activeViewContainer;
|
2008-04-12 15:09:46 +00:00
|
|
|
QVBoxLayout* m_centralWidgetLayout;
|
2009-01-19 14:25:08 +00:00
|
|
|
DolphinSearchBox* m_searchBox;
|
2009-10-17 19:24:05 +00:00
|
|
|
DolphinSearchOptionsConfigurator* m_searchOptionsConfigurator;
|
2007-02-18 17:01:36 +00:00
|
|
|
int m_id;
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2008-04-12 15:09:46 +00:00
|
|
|
struct ViewTab
|
|
|
|
{
|
2008-04-13 19:12:52 +00:00
|
|
|
ViewTab() : isPrimaryViewActive(true), primaryView(0), secondaryView(0), splitter(0) {}
|
|
|
|
bool isPrimaryViewActive;
|
2008-04-12 15:09:46 +00:00
|
|
|
DolphinViewContainer* primaryView;
|
|
|
|
DolphinViewContainer* secondaryView;
|
|
|
|
QSplitter* splitter;
|
|
|
|
};
|
|
|
|
|
|
|
|
int m_tabIndex;
|
|
|
|
QList<ViewTab> m_viewTab;
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2008-02-11 12:34:48 +00:00
|
|
|
DolphinViewActionHandler* m_actionHandler;
|
2009-03-25 22:00:50 +00:00
|
|
|
DolphinRemoteEncoding* m_remoteEncoding;
|
2009-01-13 18:06:15 +00:00
|
|
|
QPointer<DolphinSettingsDialog> m_settingsDialog;
|
2010-01-20 11:26:39 +00:00
|
|
|
|
|
|
|
KJob* m_captionStatJob;
|
2006-11-21 06:02:05 +00:00
|
|
|
};
|
|
|
|
|
2007-09-27 12:44:14 +00:00
|
|
|
inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
|
|
|
return m_activeViewContainer;
|
|
|
|
}
|
|
|
|
|
2007-09-27 12:44:14 +00:00
|
|
|
inline bool DolphinMainWindow::isSplit() const
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
2008-04-12 15:09:46 +00:00
|
|
|
return m_viewTab[m_tabIndex].secondaryView != 0;
|
2007-06-12 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 12:44:14 +00:00
|
|
|
inline KNewMenu* DolphinMainWindow::newMenu() const
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
|
|
|
return m_newMenu;
|
|
|
|
}
|
|
|
|
|
2007-11-18 14:37:57 +00:00
|
|
|
inline KAction* DolphinMainWindow::showMenuBarAction() const
|
|
|
|
{
|
|
|
|
return m_showMenuBar;
|
|
|
|
}
|
|
|
|
|
2007-09-27 12:44:14 +00:00
|
|
|
inline int DolphinMainWindow::getId() const
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
2007-03-15 19:51:48 +00:00
|
|
|
#endif // DOLPHIN_MAINWINDOW_H
|
2006-11-21 06:02:05 +00:00
|
|
|
|