2007-04-01 18:36:23 +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., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "dolphinmainwindow.h"
|
2007-12-14 15:53:40 +00:00
|
|
|
#include "dolphindropcontroller.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-06-19 19:17:32 +00:00
|
|
|
#include <config-nepomuk.h>
|
2007-05-18 23:51:03 +00:00
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
#include "dolphinapplication.h"
|
|
|
|
#include "dolphinnewmenu.h"
|
|
|
|
#include "dolphinsettings.h"
|
|
|
|
#include "dolphinsettingsdialog.h"
|
|
|
|
#include "dolphinstatusbar.h"
|
2007-06-07 21:10:48 +00:00
|
|
|
#include "dolphinviewcontainer.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
#include "infosidebarpage.h"
|
|
|
|
#include "metadatawidget.h"
|
|
|
|
#include "mainwindowadaptor.h"
|
2007-05-06 21:50:24 +00:00
|
|
|
#include "terminalsidebarpage.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
#include "treeviewsidebarpage.h"
|
2007-04-02 19:20:07 +00:00
|
|
|
#include "kurlnavigator.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
#include "viewpropertiesdialog.h"
|
|
|
|
#include "viewproperties.h"
|
2007-04-01 22:28:03 +00:00
|
|
|
#include "kfileplacesmodel.h"
|
2007-04-02 08:51:57 +00:00
|
|
|
#include "kfileplacesview.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
#include "dolphin_generalsettings.h"
|
2007-12-04 20:56:42 +00:00
|
|
|
#include "dolphin_iconsmodesettings.h"
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
#include <kaction.h>
|
|
|
|
#include <kactioncollection.h>
|
|
|
|
#include <kconfig.h>
|
|
|
|
#include <kdesktopfile.h>
|
|
|
|
#include <kdeversion.h>
|
|
|
|
#include <kfiledialog.h>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <kicon.h>
|
|
|
|
#include <kiconloader.h>
|
|
|
|
#include <kio/netaccess.h>
|
|
|
|
#include <kinputdialog.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kmenu.h>
|
2007-11-18 14:37:57 +00:00
|
|
|
#include <kmenubar.h>
|
2007-04-01 18:36:23 +00:00
|
|
|
#include <kmessagebox.h>
|
|
|
|
#include <konqmimedata.h>
|
|
|
|
#include <kpropertiesdialog.h>
|
|
|
|
#include <kprotocolinfo.h>
|
|
|
|
#include <ktoggleaction.h>
|
|
|
|
#include <krun.h>
|
|
|
|
#include <kshell.h>
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
#include <kstatusbar.h>
|
|
|
|
#include <kstandardaction.h>
|
|
|
|
#include <kurl.h>
|
|
|
|
|
2007-05-09 22:23:52 +00:00
|
|
|
#include <QtGui/QKeyEvent>
|
|
|
|
#include <QtGui/QClipboard>
|
|
|
|
#include <QtGui/QSplitter>
|
|
|
|
#include <QtGui/QDockWidget>
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
DolphinMainWindow::DolphinMainWindow(int id) :
|
2007-05-06 17:41:49 +00:00
|
|
|
KXmlGuiWindow(0),
|
|
|
|
m_newMenu(0),
|
2007-11-18 14:37:57 +00:00
|
|
|
m_showMenuBar(0),
|
2007-05-06 17:41:49 +00:00
|
|
|
m_splitter(0),
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer(0),
|
2007-05-06 17:41:49 +00:00
|
|
|
m_id(id)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
|
|
|
setObjectName("Dolphin");
|
2007-06-12 21:45:22 +00:00
|
|
|
m_viewContainer[PrimaryView] = 0;
|
|
|
|
m_viewContainer[SecondaryView] = 0;
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
new MainWindowAdaptor(this);
|
|
|
|
QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this);
|
|
|
|
|
2007-11-15 10:10:42 +00:00
|
|
|
KonqFileUndoManager::incRef();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-11-15 10:10:42 +00:00
|
|
|
KonqFileUndoManager* undoManager = KonqFileUndoManager::self();
|
2007-04-01 18:36:23 +00:00
|
|
|
undoManager->setUiInterface(new UndoUiInterface(this));
|
|
|
|
|
|
|
|
connect(undoManager, SIGNAL(undoAvailable(bool)),
|
|
|
|
this, SLOT(slotUndoAvailable(bool)));
|
|
|
|
connect(undoManager, SIGNAL(undoTextChanged(const QString&)),
|
|
|
|
this, SLOT(slotUndoTextChanged(const QString&)));
|
2007-06-15 00:52:25 +00:00
|
|
|
connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString&)),
|
|
|
|
this, SLOT(slotHandlePlacesError(const QString&)));
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DolphinMainWindow::~DolphinMainWindow()
|
|
|
|
{
|
2007-11-15 10:10:42 +00:00
|
|
|
KonqFileUndoManager::decRef();
|
2007-04-01 18:36:23 +00:00
|
|
|
DolphinApplication::app()->removeMainWindow(this);
|
|
|
|
}
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
void DolphinMainWindow::toggleViews()
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-06-12 21:45:22 +00:00
|
|
|
if (m_viewContainer[SecondaryView] == 0) {
|
2007-04-01 18:36:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
// move secondary view from the last position of the splitter
|
|
|
|
// to the first position
|
|
|
|
m_splitter->insertWidget(0, m_viewContainer[SecondaryView]);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
DolphinViewContainer* container = m_viewContainer[PrimaryView];
|
|
|
|
m_viewContainer[PrimaryView] = m_viewContainer[SecondaryView];
|
|
|
|
m_viewContainer[SecondaryView] = container;
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-11-15 20:04:05 +00:00
|
|
|
void DolphinMainWindow::slotDoingOperation(KonqFileUndoManager::CommandType commandType)
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-11-15 20:04:05 +00:00
|
|
|
m_undoCommandTypes.append(commandType);
|
2007-06-12 21:45:22 +00:00
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
void DolphinMainWindow::refreshViews()
|
|
|
|
{
|
|
|
|
Q_ASSERT(m_viewContainer[PrimaryView] != 0);
|
|
|
|
|
|
|
|
// remember the current active view, as because of
|
|
|
|
// the refreshing the active view might change to
|
|
|
|
// the secondary view
|
|
|
|
DolphinViewContainer* activeViewContainer = m_activeViewContainer;
|
|
|
|
|
|
|
|
m_viewContainer[PrimaryView]->view()->refresh();
|
|
|
|
if (m_viewContainer[SecondaryView] != 0) {
|
|
|
|
m_viewContainer[SecondaryView]->view()->refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
setActiveViewContainer(activeViewContainer);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::dropUrls(const KUrl::List& urls,
|
|
|
|
const KUrl& destination)
|
|
|
|
{
|
2007-12-14 15:53:40 +00:00
|
|
|
DolphinDropController dropController(this);
|
|
|
|
connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
|
|
|
this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
|
|
|
|
dropController.dropUrls(urls, destination);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::changeUrl(const KUrl& url)
|
|
|
|
{
|
2007-06-13 17:08:39 +00:00
|
|
|
DolphinViewContainer* view = activeViewContainer();
|
|
|
|
if (view != 0) {
|
|
|
|
view->setUrl(url);
|
2007-04-01 18:36:23 +00:00
|
|
|
updateEditActions();
|
|
|
|
updateViewActions();
|
|
|
|
updateGoActions();
|
|
|
|
setCaption(url.fileName());
|
2007-10-20 17:05:16 +00:00
|
|
|
emit urlChanged(url);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-02 19:03:03 +00:00
|
|
|
void DolphinMainWindow::changeSelection(const KFileItemList& selection)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
activeViewContainer()->view()->changeSelection(selection);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::slotViewModeChanged()
|
|
|
|
{
|
|
|
|
updateViewActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::slotShowPreviewChanged()
|
|
|
|
{
|
|
|
|
// It is not enough to update the 'Show Preview' action, also
|
|
|
|
// the 'Zoom In' and 'Zoom Out' actions must be adapted.
|
|
|
|
updateViewActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::slotShowHiddenFilesChanged()
|
|
|
|
{
|
|
|
|
KToggleAction* showHiddenFilesAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
2007-06-07 21:10:48 +00:00
|
|
|
const DolphinView* view = m_activeViewContainer->view();
|
|
|
|
showHiddenFilesAction->setChecked(view->showHiddenFiles());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-04-10 11:22:56 +00:00
|
|
|
void DolphinMainWindow::slotCategorizedSortingChanged()
|
|
|
|
{
|
2007-06-19 16:00:21 +00:00
|
|
|
KToggleAction* showInGroupsAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_in_groups"));
|
2007-06-07 21:10:48 +00:00
|
|
|
const DolphinView* view = m_activeViewContainer->view();
|
2007-06-19 16:00:21 +00:00
|
|
|
showInGroupsAction->setChecked(view->categorizedSorting());
|
|
|
|
showInGroupsAction->setEnabled(view->supportsCategorizedSorting());
|
2007-04-10 11:22:56 +00:00
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting)
|
|
|
|
{
|
|
|
|
QAction* action = 0;
|
|
|
|
switch (sorting) {
|
2007-04-09 19:12:54 +00:00
|
|
|
case DolphinView::SortByName:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_name");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortBySize:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_size");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortByDate:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_date");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortByPermissions:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_permissions");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortByOwner:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_owner");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortByGroup:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_group");
|
2007-04-09 19:12:54 +00:00
|
|
|
break;
|
2007-04-22 21:04:46 +00:00
|
|
|
case DolphinView::SortByType:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_type");
|
2007-06-22 10:18:46 +00:00
|
|
|
break;
|
|
|
|
#ifdef HAVE_NEPOMUK
|
|
|
|
case DolphinView::SortByRating:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_rating");
|
2007-06-22 10:18:46 +00:00
|
|
|
break;
|
|
|
|
case DolphinView::SortByTags:
|
2007-07-13 18:14:41 +00:00
|
|
|
action = actionCollection()->action("sort_by_tags");
|
2007-06-22 10:18:46 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2007-04-09 19:12:54 +00:00
|
|
|
default:
|
|
|
|
break;
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (action != 0) {
|
|
|
|
KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
|
|
|
|
toggleAction->setChecked(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::slotSortOrderChanged(Qt::SortOrder order)
|
|
|
|
{
|
|
|
|
KToggleAction* descending = static_cast<KToggleAction*>(actionCollection()->action("descending"));
|
2007-04-04 13:02:52 +00:00
|
|
|
const bool sortDescending = (order == Qt::DescendingOrder);
|
2007-04-01 18:36:23 +00:00
|
|
|
descending->setChecked(sortDescending);
|
|
|
|
}
|
|
|
|
|
2007-10-01 22:06:49 +00:00
|
|
|
void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::InformationList list)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-10-02 22:04:36 +00:00
|
|
|
QAction* showSizeInfo = actionCollection()->action("show_size_info");
|
|
|
|
QAction* showDateInfo = actionCollection()->action("show_date_info");
|
2007-10-26 17:36:16 +00:00
|
|
|
QAction* showPermissionsInfo = actionCollection()->action("show_permissions_info");
|
|
|
|
QAction* showOwnerInfo = actionCollection()->action("show_owner_info");
|
|
|
|
QAction* showGroupInfo = actionCollection()->action("show_group_info");
|
|
|
|
QAction* showMimeInfo = actionCollection()->action("show_mime_info");
|
2007-10-01 22:06:49 +00:00
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
showSizeInfo->setChecked(false);
|
|
|
|
showDateInfo->setChecked(false);
|
2007-10-26 17:36:16 +00:00
|
|
|
showPermissionsInfo->setChecked(false);
|
|
|
|
showOwnerInfo->setChecked(false);
|
|
|
|
showGroupInfo->setChecked(false);
|
|
|
|
showMimeInfo->setChecked(false);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
const DolphinView* view = m_activeViewContainer->view();
|
2007-10-26 17:36:16 +00:00
|
|
|
|
2007-12-04 20:56:42 +00:00
|
|
|
const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
|
|
|
|
const bool enable = (view->mode() == DolphinView::DetailsView) ||
|
|
|
|
((view->mode() == DolphinView::IconsView) && settings->showAdditionalInfo());
|
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
showSizeInfo->setEnabled(enable);
|
|
|
|
showDateInfo->setEnabled(enable);
|
2007-10-26 17:36:16 +00:00
|
|
|
showPermissionsInfo->setEnabled(enable);
|
|
|
|
showOwnerInfo->setEnabled(enable);
|
|
|
|
showGroupInfo->setEnabled(enable);
|
|
|
|
showMimeInfo->setEnabled(enable);
|
2007-10-02 22:04:36 +00:00
|
|
|
|
|
|
|
foreach (KFileItemDelegate::Information info, list) {
|
|
|
|
switch (info) {
|
|
|
|
case KFileItemDelegate::Size:
|
|
|
|
showSizeInfo->setChecked(true);
|
|
|
|
break;
|
|
|
|
case KFileItemDelegate::ModificationTime:
|
|
|
|
showDateInfo->setChecked(true);
|
|
|
|
break;
|
2007-10-26 17:36:16 +00:00
|
|
|
case KFileItemDelegate::Permissions:
|
|
|
|
showPermissionsInfo->setChecked(true);
|
|
|
|
break;
|
|
|
|
case KFileItemDelegate::Owner:
|
|
|
|
showOwnerInfo->setChecked(true);
|
|
|
|
break;
|
|
|
|
case KFileItemDelegate::OwnerAndGroup:
|
|
|
|
showGroupInfo->setChecked(true);
|
|
|
|
break;
|
|
|
|
case KFileItemDelegate::FriendlyMimeType:
|
|
|
|
showMimeInfo->setChecked(true);
|
|
|
|
break;
|
2007-10-02 22:04:36 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-02 19:03:03 +00:00
|
|
|
void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
|
|
|
updateEditActions();
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
Q_ASSERT(m_viewContainer[PrimaryView] != 0);
|
|
|
|
int selectedUrlsCount = m_viewContainer[PrimaryView]->view()->selectedUrls().count();
|
|
|
|
if (m_viewContainer[SecondaryView] != 0) {
|
|
|
|
selectedUrlsCount += m_viewContainer[SecondaryView]->view()->selectedUrls().count();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QAction* compareFilesAction = actionCollection()->action("compare_files");
|
|
|
|
compareFilesAction->setEnabled(selectedUrlsCount == 2);
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->updateStatusBar();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
emit selectionChanged(selection);
|
|
|
|
}
|
|
|
|
|
2007-07-02 17:24:54 +00:00
|
|
|
void DolphinMainWindow::slotRequestItemInfo(const KFileItem& item)
|
2007-05-17 14:51:54 +00:00
|
|
|
{
|
2007-07-02 17:24:54 +00:00
|
|
|
emit requestItemInfo(item);
|
2007-05-17 14:51:54 +00:00
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::slotHistoryChanged()
|
|
|
|
{
|
|
|
|
updateHistory();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateFilterBarAction(bool show)
|
|
|
|
{
|
|
|
|
KToggleAction* showFilterBarAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
|
|
|
showFilterBarAction->setChecked(show);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::openNewMainWindow()
|
|
|
|
{
|
|
|
|
DolphinApplication::app()->createMainWindow()->show();
|
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
void DolphinMainWindow::toggleActiveView()
|
|
|
|
{
|
2007-06-27 15:15:29 +00:00
|
|
|
if (m_viewContainer[SecondaryView] == 0) {
|
|
|
|
// only one view is available
|
|
|
|
return;
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
2007-06-27 15:15:29 +00:00
|
|
|
|
|
|
|
Q_ASSERT(m_activeViewContainer != 0);
|
|
|
|
Q_ASSERT(m_viewContainer[PrimaryView] != 0);
|
|
|
|
|
|
|
|
DolphinViewContainer* left = m_viewContainer[PrimaryView];
|
|
|
|
DolphinViewContainer* right = m_viewContainer[SecondaryView];
|
|
|
|
setActiveViewContainer(m_activeViewContainer == right ? left : right);
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::closeEvent(QCloseEvent* event)
|
|
|
|
{
|
|
|
|
DolphinSettings& settings = DolphinSettings::instance();
|
|
|
|
GeneralSettings* generalSettings = settings.generalSettings();
|
|
|
|
generalSettings->setFirstRun(false);
|
|
|
|
|
|
|
|
settings.save();
|
|
|
|
|
2007-04-16 20:44:36 +00:00
|
|
|
KXmlGuiWindow::closeEvent(event);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-11-30 18:42:17 +00:00
|
|
|
void DolphinMainWindow::saveProperties(KConfigGroup& group)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-11-30 18:42:17 +00:00
|
|
|
DolphinViewContainer* cont = m_viewContainer[PrimaryView];
|
|
|
|
group.writeEntry("Primary Url", cont->url().url());
|
|
|
|
group.writeEntry("Primary Editable Url", cont->isUrlEditable());
|
|
|
|
|
|
|
|
cont = m_viewContainer[SecondaryView];
|
|
|
|
if (cont != 0) {
|
|
|
|
group.writeEntry("Secondary Url", cont->url().url());
|
|
|
|
group.writeEntry("Secondary Editable Url", cont->isUrlEditable());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-30 18:42:17 +00:00
|
|
|
void DolphinMainWindow::readProperties(const KConfigGroup& group)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-11-30 18:42:17 +00:00
|
|
|
DolphinViewContainer* cont = m_viewContainer[PrimaryView];
|
|
|
|
|
|
|
|
cont->setUrl(group.readEntry("Primary Url"));
|
|
|
|
bool editable = group.readEntry("Primary Editable Url", false);
|
|
|
|
cont->urlNavigator()->setUrlEditable(editable);
|
|
|
|
|
|
|
|
cont = m_viewContainer[SecondaryView];
|
|
|
|
const QString secondaryUrl = group.readEntry("Secondary Url");
|
|
|
|
if (!secondaryUrl.isEmpty()) {
|
|
|
|
if (cont == 0) {
|
|
|
|
// a secondary view should be shown, but no one is available
|
|
|
|
// currently -> create a new view
|
2007-04-01 18:36:23 +00:00
|
|
|
toggleSplitView();
|
2007-11-30 18:42:17 +00:00
|
|
|
cont = m_viewContainer[SecondaryView];
|
|
|
|
Q_ASSERT(cont != 0);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
2007-11-30 18:42:17 +00:00
|
|
|
|
|
|
|
cont->setUrl(secondaryUrl);
|
|
|
|
bool editable = group.readEntry("Secondary Editable Url", false);
|
|
|
|
cont->urlNavigator()->setUrlEditable(editable);
|
|
|
|
} else if (cont != 0) {
|
|
|
|
// no secondary view should be shown, but the default setting shows
|
|
|
|
// one already -> close the view
|
2007-04-01 18:36:23 +00:00
|
|
|
toggleSplitView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateNewMenu()
|
|
|
|
{
|
|
|
|
m_newMenu->slotCheckUpToDate();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_newMenu->setPopupFiles(activeViewContainer()->url());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::rename()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-11-15 14:59:02 +00:00
|
|
|
m_activeViewContainer->view()->renameSelectedItems();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::moveToTrash()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-11-18 13:33:16 +00:00
|
|
|
|
|
|
|
DolphinView* view = m_activeViewContainer->view();
|
|
|
|
|
|
|
|
if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
|
|
|
|
view->deleteSelectedItems();
|
|
|
|
} else {
|
|
|
|
view->trashSelectedItems();
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::deleteItems()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-11-17 00:08:54 +00:00
|
|
|
m_activeViewContainer->view()->deleteSelectedItems();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::properties()
|
|
|
|
{
|
2007-10-01 08:00:48 +00:00
|
|
|
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
|
|
|
|
|
2007-12-01 14:06:07 +00:00
|
|
|
KPropertiesDialog *dialog = new KPropertiesDialog(list, this);
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
dialog->show();
|
|
|
|
dialog->raise();
|
|
|
|
dialog->activateWindow();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::quit()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
2007-06-15 00:52:25 +00:00
|
|
|
void DolphinMainWindow::slotHandlePlacesError(const QString &message)
|
|
|
|
{
|
|
|
|
if (!message.isEmpty()) {
|
|
|
|
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
|
|
|
|
statusBar->setMessage(message, DolphinStatusBar::Error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::slotUndoAvailable(bool available)
|
|
|
|
{
|
|
|
|
QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
|
|
|
|
if (undoAction != 0) {
|
|
|
|
undoAction->setEnabled(available);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (available && (m_undoCommandTypes.count() > 0)) {
|
2007-11-15 10:10:42 +00:00
|
|
|
const KonqFileUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
|
2007-04-01 18:36:23 +00:00
|
|
|
switch (command) {
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::COPY:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Copy operation completed."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::MOVE:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Move operation completed."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::LINK:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Link operation completed."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::TRASH:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Move to trash operation completed."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::RENAME:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Renaming operation completed."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
|
|
|
|
2007-11-15 10:10:42 +00:00
|
|
|
case KonqFileUndoManager::MKDIR:
|
2007-06-30 20:10:50 +00:00
|
|
|
statusBar->setMessage(i18nc("@info:status", "Created folder."),
|
2007-04-09 19:12:54 +00:00
|
|
|
DolphinStatusBar::OperationCompleted);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::slotUndoTextChanged(const QString& text)
|
|
|
|
{
|
|
|
|
QAction* undoAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Undo));
|
|
|
|
if (undoAction != 0) {
|
|
|
|
undoAction->setText(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::undo()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-11-15 10:10:42 +00:00
|
|
|
KonqFileUndoManager::self()->undo();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::cut()
|
|
|
|
{
|
2007-11-15 20:04:05 +00:00
|
|
|
m_activeViewContainer->view()->cutSelectedItems();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::copy()
|
|
|
|
{
|
2007-11-15 20:04:05 +00:00
|
|
|
m_activeViewContainer->view()->copySelectedItems();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::paste()
|
|
|
|
{
|
2007-11-15 20:04:05 +00:00
|
|
|
m_activeViewContainer->view()->paste();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updatePasteAction()
|
|
|
|
{
|
|
|
|
QAction* pasteAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Paste));
|
|
|
|
if (pasteAction == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-15 20:04:05 +00:00
|
|
|
QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo();
|
|
|
|
pasteAction->setEnabled(pasteInfo.first);
|
|
|
|
pasteAction->setText(pasteInfo.second);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::selectAll()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->selectAll();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::invertSelection()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->invertSelection();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-10-10 23:01:35 +00:00
|
|
|
void DolphinMainWindow::setViewMode(QAction* action)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-10-10 23:01:35 +00:00
|
|
|
const DolphinView::Mode mode = action->data().value<DolphinView::Mode>();
|
|
|
|
m_activeViewContainer->view()->setMode(mode);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByName()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByName);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortBySize()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortBySize);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByDate()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByDate);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByPermissions()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByPermissions);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByOwner()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByOwner);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByGroup()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByGroup);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-04-22 21:04:46 +00:00
|
|
|
void DolphinMainWindow::sortByType()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByType);
|
2007-04-22 21:04:46 +00:00
|
|
|
}
|
|
|
|
|
2007-06-22 10:18:46 +00:00
|
|
|
void DolphinMainWindow::sortByRating()
|
|
|
|
{
|
2007-06-23 13:12:21 +00:00
|
|
|
#ifdef HAVE_NEPOMUK
|
2007-06-22 10:18:46 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByRating);
|
2007-06-23 13:12:21 +00:00
|
|
|
#endif
|
2007-06-22 10:18:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::sortByTags()
|
|
|
|
{
|
2007-06-23 13:12:21 +00:00
|
|
|
#ifdef HAVE_NEPOMUK
|
2007-06-22 10:18:46 +00:00
|
|
|
m_activeViewContainer->view()->setSorting(DolphinView::SortByTags);
|
2007-06-23 13:12:21 +00:00
|
|
|
#endif
|
2007-06-22 10:18:46 +00:00
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::toggleSortOrder()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinView* view = m_activeViewContainer->view();
|
|
|
|
const Qt::SortOrder order = (view->sortOrder() == Qt::AscendingOrder) ?
|
2007-04-04 13:02:52 +00:00
|
|
|
Qt::DescendingOrder :
|
|
|
|
Qt::AscendingOrder;
|
2007-06-07 21:10:48 +00:00
|
|
|
view->setSortOrder(order);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-04-10 11:22:56 +00:00
|
|
|
void DolphinMainWindow::toggleSortCategorization()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinView* view = m_activeViewContainer->view();
|
|
|
|
const bool categorizedSorting = view->categorizedSorting();
|
|
|
|
view->setCategorizedSorting(!categorizedSorting);
|
2007-04-10 11:22:56 +00:00
|
|
|
}
|
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
void DolphinMainWindow::toggleSizeInfo()
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-10-02 22:04:36 +00:00
|
|
|
toggleAdditionalInfo("show_size_info", KFileItemDelegate::Size);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
void DolphinMainWindow::toggleDateInfo()
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
2007-10-02 22:04:36 +00:00
|
|
|
toggleAdditionalInfo("show_date_info", KFileItemDelegate::ModificationTime);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-10-26 17:36:16 +00:00
|
|
|
void DolphinMainWindow::togglePermissionsInfo()
|
|
|
|
{
|
|
|
|
toggleAdditionalInfo("show_permissions_info", KFileItemDelegate::Permissions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::toggleOwnerInfo()
|
|
|
|
{
|
|
|
|
toggleAdditionalInfo("show_owner_info", KFileItemDelegate::Owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::toggleGroupInfo()
|
|
|
|
{
|
|
|
|
toggleAdditionalInfo("show_group_info", KFileItemDelegate::OwnerAndGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::toggleMimeInfo()
|
|
|
|
{
|
|
|
|
toggleAdditionalInfo("show_mime_info", KFileItemDelegate::FriendlyMimeType);
|
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::toggleSplitView()
|
|
|
|
{
|
2007-06-12 21:45:22 +00:00
|
|
|
if (m_viewContainer[SecondaryView] == 0) {
|
2007-04-01 18:36:23 +00:00
|
|
|
// create a secondary view
|
2007-08-12 17:48:29 +00:00
|
|
|
const int newWidth = (m_viewContainer[PrimaryView]->width() - m_splitter->handleWidth()) / 2;
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
const DolphinView* view = m_viewContainer[PrimaryView]->view();
|
2007-08-12 17:48:29 +00:00
|
|
|
m_viewContainer[SecondaryView] = new DolphinViewContainer(this, 0, view->rootUrl());
|
2007-06-12 21:45:22 +00:00
|
|
|
connectViewSignals(SecondaryView);
|
|
|
|
m_splitter->addWidget(m_viewContainer[SecondaryView]);
|
2007-04-01 18:36:23 +00:00
|
|
|
m_splitter->setSizes(QList<int>() << newWidth << newWidth);
|
2007-06-12 21:45:22 +00:00
|
|
|
m_viewContainer[SecondaryView]->view()->reload();
|
|
|
|
m_viewContainer[SecondaryView]->setActive(false);
|
|
|
|
m_viewContainer[SecondaryView]->show();
|
2007-08-12 17:48:29 +00:00
|
|
|
} else if (m_activeViewContainer == m_viewContainer[PrimaryView]) {
|
2007-04-01 18:36:23 +00:00
|
|
|
// remove secondary view
|
2007-06-12 21:45:22 +00:00
|
|
|
m_viewContainer[SecondaryView]->close();
|
|
|
|
m_viewContainer[SecondaryView]->deleteLater();
|
|
|
|
m_viewContainer[SecondaryView] = 0;
|
2007-08-12 17:48:29 +00:00
|
|
|
} else {
|
|
|
|
// The secondary view is active, hence from a users point of view
|
|
|
|
// the content of the secondary view should be moved to the primary view.
|
|
|
|
// From an implementation point of view it is more efficient to close
|
|
|
|
// the primary view and exchange the internal pointers afterwards.
|
|
|
|
m_viewContainer[PrimaryView]->close();
|
|
|
|
m_viewContainer[PrimaryView]->deleteLater();
|
|
|
|
m_viewContainer[PrimaryView] = m_viewContainer[SecondaryView];
|
|
|
|
m_viewContainer[SecondaryView] = 0;
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
2007-06-07 21:41:22 +00:00
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
setActiveViewContainer(m_viewContainer[PrimaryView]);
|
2007-06-07 21:41:22 +00:00
|
|
|
updateViewActions();
|
2007-04-01 18:36:23 +00:00
|
|
|
emit activeViewChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::reloadView()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->reload();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::stopLoading()
|
2007-06-12 21:45:22 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
void DolphinMainWindow::togglePreview()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
|
|
|
|
|
|
|
const KToggleAction* showPreviewAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
|
|
|
|
const bool show = showPreviewAction->isChecked();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setShowPreview(show);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::toggleShowHiddenFiles()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
|
|
|
|
|
|
|
const KToggleAction* showHiddenFilesAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
|
|
|
const bool show = showHiddenFilesAction->isChecked();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->setShowHiddenFiles(show);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-05-06 21:50:24 +00:00
|
|
|
void DolphinMainWindow::toggleFilterBarVisibility()
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
|
|
|
const KToggleAction* showFilterBarAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
|
|
|
const bool show = showFilterBarAction->isChecked();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->showFilterBar(show);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::zoomIn()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->zoomIn();
|
2007-04-01 18:36:23 +00:00
|
|
|
updateViewActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::zoomOut()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->view()->zoomOut();
|
2007-04-01 18:36:23 +00:00
|
|
|
updateViewActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::toggleEditLocation()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
|
|
|
|
|
|
|
KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
|
|
|
|
|
|
|
bool editOrBrowse = action->isChecked();
|
2007-06-07 21:10:48 +00:00
|
|
|
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
|
|
|
urlNavigator->setUrlEditable(editOrBrowse);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::editLocation()
|
|
|
|
{
|
2007-11-04 18:50:22 +00:00
|
|
|
KUrlNavigator* navigator = m_activeViewContainer->urlNavigator();
|
|
|
|
navigator->setUrlEditable(true);
|
|
|
|
navigator->setFocus();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::adjustViewProperties()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
ViewPropertiesDialog dlg(m_activeViewContainer->view());
|
2007-04-01 18:36:23 +00:00
|
|
|
dlg.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::goBack()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->urlNavigator()->goBack();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::goForward()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->urlNavigator()->goForward();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::goUp()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->urlNavigator()->goUp();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::goHome()
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->urlNavigator()->goHome();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::findFile()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
KRun::run("kfind", m_activeViewContainer->url(), this);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::compareFiles()
|
|
|
|
{
|
|
|
|
// The method is only invoked if exactly 2 files have
|
|
|
|
// been selected. The selected files may be:
|
|
|
|
// - both in the primary view
|
|
|
|
// - both in the secondary view
|
|
|
|
// - one in the primary view and the other in the secondary
|
|
|
|
// view
|
2007-06-12 21:45:22 +00:00
|
|
|
Q_ASSERT(m_viewContainer[PrimaryView] != 0);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KUrl urlA;
|
|
|
|
KUrl urlB;
|
2007-06-12 21:45:22 +00:00
|
|
|
KUrl::List urls = m_viewContainer[PrimaryView]->view()->selectedUrls();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
switch (urls.count()) {
|
2007-04-09 19:12:54 +00:00
|
|
|
case 0: {
|
2007-06-12 21:45:22 +00:00
|
|
|
Q_ASSERT(m_viewContainer[SecondaryView] != 0);
|
|
|
|
urls = m_viewContainer[SecondaryView]->view()->selectedUrls();
|
2007-04-09 19:12:54 +00:00
|
|
|
Q_ASSERT(urls.count() == 2);
|
|
|
|
urlA = urls[0];
|
|
|
|
urlB = urls[1];
|
|
|
|
break;
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
case 1: {
|
|
|
|
urlA = urls[0];
|
2007-06-12 21:45:22 +00:00
|
|
|
Q_ASSERT(m_viewContainer[SecondaryView] != 0);
|
|
|
|
urls = m_viewContainer[SecondaryView]->view()->selectedUrls();
|
2007-04-09 19:12:54 +00:00
|
|
|
Q_ASSERT(urls.count() == 1);
|
|
|
|
urlB = urls[0];
|
|
|
|
break;
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
case 2: {
|
|
|
|
urlA = urls[0];
|
|
|
|
urlB = urls[1];
|
|
|
|
break;
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
default: {
|
|
|
|
// may not happen: compareFiles may only get invoked if 2
|
|
|
|
// files are selected
|
|
|
|
Q_ASSERT(false);
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString command("kompare -c \"");
|
|
|
|
command.append(urlA.pathOrUrl());
|
|
|
|
command.append("\" \"");
|
|
|
|
command.append(urlB.pathOrUrl());
|
|
|
|
command.append('\"');
|
2007-05-07 15:10:51 +00:00
|
|
|
KRun::runCommand(command, "Kompare", "kompare", this);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-11-18 14:37:57 +00:00
|
|
|
void DolphinMainWindow::toggleShowMenuBar()
|
|
|
|
{
|
|
|
|
const bool visible = menuBar()->isVisible();
|
|
|
|
menuBar()->setVisible(!visible);
|
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::editSettings()
|
|
|
|
{
|
2007-05-05 21:02:04 +00:00
|
|
|
DolphinSettingsDialog dialog(this);
|
|
|
|
dialog.exec();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::init()
|
|
|
|
{
|
|
|
|
// Check whether Dolphin runs the first time. If yes then
|
|
|
|
// a proper default window size is given at the end of DolphinMainWindow::init().
|
|
|
|
GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
|
|
|
|
const bool firstRun = generalSettings->firstRun();
|
|
|
|
if (firstRun) {
|
|
|
|
generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
|
|
|
|
}
|
|
|
|
|
|
|
|
setAcceptDrops(true);
|
|
|
|
|
|
|
|
m_splitter = new QSplitter(this);
|
|
|
|
|
|
|
|
DolphinSettings& settings = DolphinSettings::instance();
|
|
|
|
|
|
|
|
setupActions();
|
|
|
|
|
|
|
|
const KUrl& homeUrl = settings.generalSettings()->homeUrl();
|
|
|
|
setCaption(homeUrl.fileName());
|
|
|
|
ViewProperties props(homeUrl);
|
2007-06-12 21:45:22 +00:00
|
|
|
m_viewContainer[PrimaryView] = new DolphinViewContainer(this,
|
2007-06-19 16:35:52 +00:00
|
|
|
m_splitter,
|
|
|
|
homeUrl);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
m_activeViewContainer = m_viewContainer[PrimaryView];
|
|
|
|
connectViewSignals(PrimaryView);
|
|
|
|
m_viewContainer[PrimaryView]->view()->reload();
|
|
|
|
m_viewContainer[PrimaryView]->show();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
setCentralWidget(m_splitter);
|
|
|
|
setupDockWidgets();
|
|
|
|
|
2007-04-09 19:12:54 +00:00
|
|
|
setupGUI(Keys | Save | Create | ToolBar);
|
2007-04-01 18:36:23 +00:00
|
|
|
createGUI();
|
|
|
|
|
|
|
|
stateChanged("new_file");
|
|
|
|
setAutoSaveSettings();
|
|
|
|
|
|
|
|
QClipboard* clipboard = QApplication::clipboard();
|
|
|
|
connect(clipboard, SIGNAL(dataChanged()),
|
|
|
|
this, SLOT(updatePasteAction()));
|
|
|
|
updatePasteAction();
|
|
|
|
updateGoActions();
|
|
|
|
|
2007-08-12 17:48:29 +00:00
|
|
|
if (generalSettings->splitView()) {
|
2007-06-20 15:46:57 +00:00
|
|
|
toggleSplitView();
|
|
|
|
}
|
|
|
|
updateViewActions();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
if (firstRun) {
|
|
|
|
// assure a proper default size if Dolphin runs the first time
|
2007-06-07 21:10:48 +00:00
|
|
|
resize(700, 500);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
emit urlChanged(homeUrl);
|
|
|
|
}
|
|
|
|
|
2007-06-12 21:45:22 +00:00
|
|
|
void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* view)
|
|
|
|
{
|
2007-06-27 15:15:29 +00:00
|
|
|
Q_ASSERT(view != 0);
|
2007-06-12 21:45:22 +00:00
|
|
|
Q_ASSERT((view == m_viewContainer[PrimaryView]) || (view == m_viewContainer[SecondaryView]));
|
2007-06-27 15:15:29 +00:00
|
|
|
if (m_activeViewContainer == view) {
|
2007-06-12 21:45:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_activeViewContainer->setActive(false);
|
|
|
|
m_activeViewContainer = view;
|
|
|
|
m_activeViewContainer->setActive(true);
|
|
|
|
|
|
|
|
updateHistory();
|
|
|
|
updateEditActions();
|
|
|
|
updateViewActions();
|
|
|
|
updateGoActions();
|
|
|
|
|
2007-06-13 17:08:39 +00:00
|
|
|
const KUrl& url = m_activeViewContainer->url();
|
|
|
|
setCaption(url.fileName());
|
2007-06-12 21:45:22 +00:00
|
|
|
|
|
|
|
emit activeViewChanged();
|
2007-06-13 17:08:39 +00:00
|
|
|
emit urlChanged(url);
|
2007-06-12 21:45:22 +00:00
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
void DolphinMainWindow::setupActions()
|
|
|
|
{
|
|
|
|
// setup 'File' menu
|
|
|
|
m_newMenu = new DolphinNewMenu(this);
|
|
|
|
KMenu* menu = m_newMenu->menu();
|
2007-06-30 20:10:50 +00:00
|
|
|
menu->setTitle(i18nc("@title:menu", "Create New"));
|
2007-04-01 18:36:23 +00:00
|
|
|
menu->setIcon(KIcon("document-new"));
|
|
|
|
connect(menu, SIGNAL(aboutToShow()),
|
|
|
|
this, SLOT(updateNewMenu()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* newWindow = actionCollection()->addAction("new_window");
|
2007-04-01 18:36:23 +00:00
|
|
|
newWindow->setIcon(KIcon("window-new"));
|
2007-06-30 20:10:50 +00:00
|
|
|
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
|
2007-04-01 18:36:23 +00:00
|
|
|
newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
|
|
|
|
connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
|
|
|
|
|
2007-11-17 00:08:54 +00:00
|
|
|
KAction* rename = DolphinView::createRenameAction(actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(rename, SIGNAL(triggered()), this, SLOT(rename()));
|
|
|
|
|
2007-11-17 00:08:54 +00:00
|
|
|
KAction* moveToTrash = DolphinView::createMoveToTrashAction(actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(moveToTrash, SIGNAL(triggered()), this, SLOT(moveToTrash()));
|
|
|
|
|
2007-11-17 00:08:54 +00:00
|
|
|
KAction* deleteAction = DolphinView::createDeleteAction(actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItems()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* properties = actionCollection()->addAction("properties");
|
2007-06-30 20:10:50 +00:00
|
|
|
properties->setText(i18nc("@action:inmenu File", "Properties"));
|
2007-04-01 18:36:23 +00:00
|
|
|
properties->setShortcut(Qt::ALT | Qt::Key_Return);
|
|
|
|
connect(properties, SIGNAL(triggered()), this, SLOT(properties()));
|
|
|
|
|
|
|
|
KStandardAction::quit(this, SLOT(quit()), actionCollection());
|
|
|
|
|
|
|
|
// setup 'Edit' menu
|
|
|
|
KStandardAction::undo(this,
|
|
|
|
SLOT(undo()),
|
|
|
|
actionCollection());
|
|
|
|
|
2007-11-02 20:50:05 +00:00
|
|
|
//Need to remove shift+del from cut action, else the shortcut for deletejob
|
|
|
|
//doesn't work
|
|
|
|
KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
|
|
|
|
KShortcut cutShortcut = cut->shortcut();
|
|
|
|
cutShortcut.remove(Qt::SHIFT + Qt::Key_Delete, KShortcut::KeepEmpty);
|
|
|
|
cut->setShortcut(cutShortcut);
|
2007-04-01 18:36:23 +00:00
|
|
|
KStandardAction::copy(this, SLOT(copy()), actionCollection());
|
|
|
|
KStandardAction::paste(this, SLOT(paste()), actionCollection());
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* selectAll = actionCollection()->addAction("select_all");
|
2007-06-30 20:10:50 +00:00
|
|
|
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
|
2007-04-01 18:36:23 +00:00
|
|
|
selectAll->setShortcut(Qt::CTRL + Qt::Key_A);
|
|
|
|
connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* invertSelection = actionCollection()->addAction("invert_selection");
|
2007-06-30 20:10:50 +00:00
|
|
|
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
|
2007-04-01 18:36:23 +00:00
|
|
|
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
|
|
|
|
connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
|
|
|
|
|
|
|
|
// setup 'View' menu
|
|
|
|
KStandardAction::zoomIn(this,
|
2007-04-09 19:12:54 +00:00
|
|
|
SLOT(zoomIn()),
|
|
|
|
actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KStandardAction::zoomOut(this,
|
2007-04-09 19:12:54 +00:00
|
|
|
SLOT(zoomOut()),
|
|
|
|
actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
|
2007-10-10 23:01:35 +00:00
|
|
|
KToggleAction* iconsView = DolphinView::iconsModeAction(actionCollection());
|
|
|
|
KToggleAction* detailsView = DolphinView::detailsModeAction(actionCollection());
|
|
|
|
KToggleAction* columnView = DolphinView::columnsModeAction(actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
QActionGroup* viewModeGroup = new QActionGroup(this);
|
|
|
|
viewModeGroup->addAction(iconsView);
|
|
|
|
viewModeGroup->addAction(detailsView);
|
|
|
|
viewModeGroup->addAction(columnView);
|
2007-10-10 23:01:35 +00:00
|
|
|
connect(viewModeGroup, SIGNAL(triggered(QAction*)), this, SLOT(setViewMode(QAction*)));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByName = actionCollection()->add<KToggleAction>("sort_by_name");
|
|
|
|
sortByName->setText(i18nc("@action:inmenu Sort By", "Name"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortByName, SIGNAL(triggered()), this, SLOT(sortByName()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortBySize = actionCollection()->add<KToggleAction>("sort_by_size");
|
|
|
|
sortBySize->setText(i18nc("@action:inmenu Sort By", "Size"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortBySize, SIGNAL(triggered()), this, SLOT(sortBySize()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByDate = actionCollection()->add<KToggleAction>("sort_by_date");
|
|
|
|
sortByDate->setText(i18nc("@action:inmenu Sort By", "Date"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortByDate, SIGNAL(triggered()), this, SLOT(sortByDate()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByPermissions = actionCollection()->add<KToggleAction>("sort_by_permissions");
|
|
|
|
sortByPermissions->setText(i18nc("@action:inmenu Sort By", "Permissions"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortByPermissions, SIGNAL(triggered()), this, SLOT(sortByPermissions()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByOwner = actionCollection()->add<KToggleAction>("sort_by_owner");
|
|
|
|
sortByOwner->setText(i18nc("@action:inmenu Sort By", "Owner"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortByOwner, SIGNAL(triggered()), this, SLOT(sortByOwner()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByGroup = actionCollection()->add<KToggleAction>("sort_by_group");
|
|
|
|
sortByGroup->setText(i18nc("@action:inmenu Sort By", "Group"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortByGroup, SIGNAL(triggered()), this, SLOT(sortByGroup()));
|
|
|
|
|
2007-07-13 18:14:41 +00:00
|
|
|
KToggleAction* sortByType = actionCollection()->add<KToggleAction>("sort_by_type");
|
|
|
|
sortByType->setText(i18nc("@action:inmenu Sort By", "Type"));
|
2007-04-22 21:04:46 +00:00
|
|
|
connect(sortByType, SIGNAL(triggered()), this, SLOT(sortByType()));
|
|
|
|
|
2007-11-30 19:19:38 +00:00
|
|
|
// TODO: Hided "sort by rating" and "sort by tags" as without caching the performance
|
|
|
|
// is too slow currently (Nepomuk will support caching in future releases).
|
|
|
|
//
|
|
|
|
// KToggleAction* sortByRating = actionCollection()->add<KToggleAction>("sort_by_rating");
|
|
|
|
// sortByRating->setText(i18nc("@action:inmenu Sort By", "Rating"));
|
|
|
|
//
|
|
|
|
// KToggleAction* sortByTags = actionCollection()->add<KToggleAction>("sort_by_tags");
|
|
|
|
// sortByTags->setText(i18nc("@action:inmenu Sort By", "Tags"));
|
|
|
|
//
|
2007-06-22 10:18:46 +00:00
|
|
|
#ifdef HAVE_NEPOMUK
|
2007-11-30 19:19:38 +00:00
|
|
|
// if (MetaDataWidget::metaDataAvailable()) {
|
|
|
|
// connect(sortByRating, SIGNAL(triggered()), this, SLOT(sortByRating()));
|
|
|
|
// connect(sortByTags, SIGNAL(triggered()), this, SLOT(sortByTags()));
|
|
|
|
// }
|
|
|
|
// else {
|
|
|
|
// sortByRating->setEnabled(false);
|
|
|
|
// sortByTags->setEnabled(false);
|
|
|
|
// }
|
2007-06-22 10:18:46 +00:00
|
|
|
#else
|
2007-11-30 19:19:38 +00:00
|
|
|
// sortByRating->setEnabled(false);
|
|
|
|
// sortByTags->setEnabled(false);
|
2007-06-22 10:18:46 +00:00
|
|
|
#endif
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
QActionGroup* sortGroup = new QActionGroup(this);
|
|
|
|
sortGroup->addAction(sortByName);
|
|
|
|
sortGroup->addAction(sortBySize);
|
|
|
|
sortGroup->addAction(sortByDate);
|
|
|
|
sortGroup->addAction(sortByPermissions);
|
|
|
|
sortGroup->addAction(sortByOwner);
|
|
|
|
sortGroup->addAction(sortByGroup);
|
2007-04-22 21:04:46 +00:00
|
|
|
sortGroup->addAction(sortByType);
|
2007-11-30 19:19:38 +00:00
|
|
|
|
|
|
|
// TODO: Hided "sort by rating" and "sort by tags" as without caching the performance
|
|
|
|
// is too slow currently (Nepomuk will support caching in future releases).
|
|
|
|
//sortGroup->addAction(sortByRating);
|
|
|
|
//sortGroup->addAction(sortByTags);
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* sortDescending = actionCollection()->add<KToggleAction>("descending");
|
2007-06-30 20:10:50 +00:00
|
|
|
sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
|
|
|
|
|
2007-06-19 16:00:21 +00:00
|
|
|
KToggleAction* showInGroups = actionCollection()->add<KToggleAction>("show_in_groups");
|
2007-06-30 20:10:50 +00:00
|
|
|
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
|
2007-06-19 16:00:21 +00:00
|
|
|
connect(showInGroups, SIGNAL(triggered()), this, SLOT(toggleSortCategorization()));
|
2007-04-10 11:22:56 +00:00
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
KToggleAction* showSizeInfo = actionCollection()->add<KToggleAction>("show_size_info");
|
2007-06-30 20:10:50 +00:00
|
|
|
showSizeInfo->setText(i18nc("@action:inmenu Additional information", "Size"));
|
2007-10-02 22:04:36 +00:00
|
|
|
connect(showSizeInfo, SIGNAL(triggered()), this, SLOT(toggleSizeInfo()));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* showDateInfo = actionCollection()->add<KToggleAction>("show_date_info");
|
2007-06-30 20:10:50 +00:00
|
|
|
showDateInfo->setText(i18nc("@action:inmenu Additional information", "Date"));
|
2007-10-02 22:04:36 +00:00
|
|
|
connect(showDateInfo, SIGNAL(triggered()), this, SLOT(toggleDateInfo()));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-10-26 17:36:16 +00:00
|
|
|
KToggleAction* showPermissionsInfo = actionCollection()->add<KToggleAction>("show_permissions_info");
|
|
|
|
showPermissionsInfo->setText(i18nc("@action:inmenu Additional information", "Permissions"));
|
|
|
|
connect(showPermissionsInfo, SIGNAL(triggered()), this, SLOT(togglePermissionsInfo()));
|
|
|
|
|
|
|
|
KToggleAction* showOwnerInfo = actionCollection()->add<KToggleAction>("show_owner_info");
|
|
|
|
showOwnerInfo->setText(i18nc("@action:inmenu Additional information", "Owner"));
|
|
|
|
connect(showOwnerInfo, SIGNAL(triggered()), this, SLOT(toggleOwnerInfo()));
|
|
|
|
|
|
|
|
KToggleAction* showGroupInfo = actionCollection()->add<KToggleAction>("show_group_info");
|
|
|
|
showGroupInfo->setText(i18nc("@action:inmenu Additional information", "Group"));
|
|
|
|
connect(showGroupInfo, SIGNAL(triggered()), this, SLOT(toggleGroupInfo()));
|
|
|
|
|
|
|
|
KToggleAction* showMimeInfo = actionCollection()->add<KToggleAction>("show_mime_info");
|
|
|
|
showMimeInfo->setText(i18nc("@action:inmenu Additional information", "Type"));
|
|
|
|
connect(showMimeInfo, SIGNAL(triggered()), this, SLOT(toggleMimeInfo()));
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
KToggleAction* showPreview = actionCollection()->add<KToggleAction>("show_preview");
|
2007-06-30 20:10:50 +00:00
|
|
|
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
|
2007-06-03 15:19:52 +00:00
|
|
|
showPreview->setIcon(KIcon("fileview-preview"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(showPreview, SIGNAL(triggered()), this, SLOT(togglePreview()));
|
|
|
|
|
|
|
|
KToggleAction* showHiddenFiles = actionCollection()->add<KToggleAction>("show_hidden_files");
|
2007-06-30 20:10:50 +00:00
|
|
|
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
|
2007-04-01 18:36:23 +00:00
|
|
|
showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_Period);
|
|
|
|
connect(showHiddenFiles, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* split = actionCollection()->addAction("split_view");
|
2007-04-01 18:36:23 +00:00
|
|
|
split->setShortcut(Qt::Key_F10);
|
2007-08-12 17:48:29 +00:00
|
|
|
updateSplitAction();
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* reload = actionCollection()->addAction("reload");
|
2007-06-30 20:10:50 +00:00
|
|
|
reload->setText(i18nc("@action:inmenu View", "Reload"));
|
2007-04-01 18:36:23 +00:00
|
|
|
reload->setShortcut(Qt::Key_F5);
|
|
|
|
reload->setIcon(KIcon("view-refresh"));
|
|
|
|
connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* stop = actionCollection()->addAction("stop");
|
2007-06-30 20:10:50 +00:00
|
|
|
stop->setText(i18nc("@action:inmenu View", "Stop"));
|
2007-04-01 18:36:23 +00:00
|
|
|
stop->setIcon(KIcon("process-stop"));
|
|
|
|
connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
|
|
|
|
|
|
|
|
// TODO: the URL navigator must emit a signal if the editable state has been
|
|
|
|
// changed, so that the corresponding showFullLocation action is updated. Also
|
|
|
|
// the naming "Show full Location" is currently confusing...
|
|
|
|
KToggleAction* showFullLocation = actionCollection()->add<KToggleAction>("editable_location");
|
2007-06-30 20:10:50 +00:00
|
|
|
showFullLocation->setText(i18nc("@action:inmenu Navigation Bar", "Show Full Location"));
|
2007-04-01 18:36:23 +00:00
|
|
|
showFullLocation->setShortcut(Qt::CTRL | Qt::Key_L);
|
|
|
|
connect(showFullLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* editLocation = actionCollection()->addAction("edit_location");
|
2007-06-30 20:10:50 +00:00
|
|
|
editLocation->setText(i18nc("@action:inmenu Navigation Bar", "Edit Location"));
|
2007-04-01 18:36:23 +00:00
|
|
|
editLocation->setShortcut(Qt::Key_F6);
|
|
|
|
connect(editLocation, SIGNAL(triggered()), this, SLOT(editLocation()));
|
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* adjustViewProps = actionCollection()->addAction("view_properties");
|
2007-06-30 20:10:50 +00:00
|
|
|
adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(adjustViewProperties()));
|
|
|
|
|
|
|
|
// setup 'Go' menu
|
2007-09-09 19:02:22 +00:00
|
|
|
KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
|
|
|
|
KShortcut backShortcut = backAction->shortcut();
|
|
|
|
backShortcut.setAlternate(Qt::Key_Backspace);
|
|
|
|
backAction->setShortcut(backShortcut);
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
KStandardAction::forward(this, SLOT(goForward()), actionCollection());
|
|
|
|
KStandardAction::up(this, SLOT(goUp()), actionCollection());
|
|
|
|
KStandardAction::home(this, SLOT(goHome()), actionCollection());
|
|
|
|
|
|
|
|
// setup 'Tools' menu
|
|
|
|
QAction* findFile = actionCollection()->addAction("find_file");
|
2007-06-30 20:10:50 +00:00
|
|
|
findFile->setText(i18nc("@action:inmenu Tools", "Find File..."));
|
2007-04-14 17:21:53 +00:00
|
|
|
findFile->setShortcut(Qt::CTRL | Qt::Key_F);
|
2007-11-04 21:54:49 +00:00
|
|
|
findFile->setIcon(KIcon("edit-find"));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(findFile, SIGNAL(triggered()), this, SLOT(findFile()));
|
|
|
|
|
|
|
|
KToggleAction* showFilterBar = actionCollection()->add<KToggleAction>("show_filter_bar");
|
2007-06-30 20:10:50 +00:00
|
|
|
showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
|
2007-05-07 05:33:20 +00:00
|
|
|
showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
|
2007-05-06 21:50:24 +00:00
|
|
|
connect(showFilterBar, SIGNAL(triggered()), this, SLOT(toggleFilterBarVisibility()));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-10-29 11:03:37 +00:00
|
|
|
KAction* compareFiles = actionCollection()->addAction("compare_files");
|
2007-06-30 20:10:50 +00:00
|
|
|
compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
|
2007-04-01 18:36:23 +00:00
|
|
|
compareFiles->setIcon(KIcon("kompare"));
|
|
|
|
compareFiles->setEnabled(false);
|
|
|
|
connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
|
|
|
|
|
|
|
|
// setup 'Settings' menu
|
2007-11-18 14:37:57 +00:00
|
|
|
m_showMenuBar = KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection());
|
2007-04-01 18:36:23 +00:00
|
|
|
KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::setupDockWidgets()
|
|
|
|
{
|
|
|
|
// setup "Information"
|
2007-06-30 20:10:50 +00:00
|
|
|
QDockWidget* infoDock = new QDockWidget(i18nc("@title:window", "Information"));
|
2007-04-01 18:36:23 +00:00
|
|
|
infoDock->setObjectName("infoDock");
|
|
|
|
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
|
|
|
SidebarPage* infoWidget = new InfoSidebarPage(infoDock);
|
|
|
|
infoDock->setWidget(infoWidget);
|
|
|
|
|
2007-06-30 20:10:50 +00:00
|
|
|
infoDock->toggleViewAction()->setText(i18nc("@title:window", "Information"));
|
2007-09-09 12:54:24 +00:00
|
|
|
infoDock->toggleViewAction()->setShortcut(Qt::Key_F11);
|
2007-04-01 18:36:23 +00:00
|
|
|
actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
|
|
|
|
|
|
|
|
addDockWidget(Qt::RightDockWidgetArea, infoDock);
|
2007-05-02 05:15:03 +00:00
|
|
|
connect(this, SIGNAL(urlChanged(KUrl)),
|
|
|
|
infoWidget, SLOT(setUrl(KUrl)));
|
2007-10-02 19:03:03 +00:00
|
|
|
connect(this, SIGNAL(selectionChanged(KFileItemList)),
|
|
|
|
infoWidget, SLOT(setSelection(KFileItemList)));
|
2007-07-02 17:24:54 +00:00
|
|
|
connect(this, SIGNAL(requestItemInfo(KFileItem)),
|
|
|
|
infoWidget, SLOT(requestDelayedItemInfo(KFileItem)));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
// setup "Tree View"
|
2007-06-30 20:10:50 +00:00
|
|
|
QDockWidget* treeViewDock = new QDockWidget(i18nc("@title:window", "Folders"));
|
2007-04-01 18:36:23 +00:00
|
|
|
treeViewDock->setObjectName("treeViewDock");
|
|
|
|
treeViewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
|
|
|
TreeViewSidebarPage* treeWidget = new TreeViewSidebarPage(treeViewDock);
|
|
|
|
treeViewDock->setWidget(treeWidget);
|
|
|
|
|
2007-06-30 20:10:50 +00:00
|
|
|
treeViewDock->toggleViewAction()->setText(i18nc("@title:window", "Folders"));
|
2007-08-30 06:20:24 +00:00
|
|
|
treeViewDock->toggleViewAction()->setShortcut(Qt::Key_F7);
|
2007-04-01 18:36:23 +00:00
|
|
|
actionCollection()->addAction("show_folders_panel", treeViewDock->toggleViewAction());
|
|
|
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, treeViewDock);
|
2007-05-02 05:15:03 +00:00
|
|
|
connect(this, SIGNAL(urlChanged(KUrl)),
|
|
|
|
treeWidget, SLOT(setUrl(KUrl)));
|
|
|
|
connect(treeWidget, SIGNAL(changeUrl(KUrl)),
|
|
|
|
this, SLOT(changeUrl(KUrl)));
|
2007-10-02 19:03:03 +00:00
|
|
|
connect(treeWidget, SIGNAL(changeSelection(KFileItemList)),
|
|
|
|
this, SLOT(changeSelection(KFileItemList)));
|
2007-05-02 05:15:03 +00:00
|
|
|
connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)),
|
|
|
|
this, SLOT(dropUrls(KUrl::List, KUrl)));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-05-06 21:50:24 +00:00
|
|
|
// setup "Terminal"
|
2007-06-30 20:10:50 +00:00
|
|
|
QDockWidget* terminalDock = new QDockWidget(i18nc("@title:window", "Terminal"));
|
2007-05-06 21:50:24 +00:00
|
|
|
terminalDock->setObjectName("terminalDock");
|
|
|
|
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
|
|
|
SidebarPage* terminalWidget = new TerminalSidebarPage(terminalDock);
|
|
|
|
terminalDock->setWidget(terminalWidget);
|
|
|
|
|
2007-06-30 20:10:50 +00:00
|
|
|
terminalDock->toggleViewAction()->setText(i18nc("@title:window", "Terminal"));
|
2007-07-13 18:25:36 +00:00
|
|
|
terminalDock->toggleViewAction()->setShortcut(Qt::Key_F4);
|
2007-05-06 21:50:24 +00:00
|
|
|
actionCollection()->addAction("show_terminal_panel", terminalDock->toggleViewAction());
|
|
|
|
|
2007-07-25 17:32:37 +00:00
|
|
|
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
|
2007-05-06 21:50:24 +00:00
|
|
|
connect(this, SIGNAL(urlChanged(KUrl)),
|
|
|
|
terminalWidget, SLOT(setUrl(KUrl)));
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
|
|
|
|
if (firstRun) {
|
2007-04-22 21:27:40 +00:00
|
|
|
infoDock->hide();
|
2007-04-01 18:36:23 +00:00
|
|
|
treeViewDock->hide();
|
2007-05-06 21:50:24 +00:00
|
|
|
terminalDock->hide();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
2007-04-01 22:28:03 +00:00
|
|
|
|
2007-10-24 20:28:28 +00:00
|
|
|
QDockWidget* placesDock = new QDockWidget(i18nc("@title:window", "Places"));
|
2007-04-01 22:28:03 +00:00
|
|
|
placesDock->setObjectName("placesDock");
|
|
|
|
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
2007-10-24 20:28:28 +00:00
|
|
|
KFilePlacesView* placesView = new KFilePlacesView(placesDock);
|
|
|
|
placesDock->setWidget(placesView);
|
|
|
|
placesView->setModel(DolphinSettings::instance().placesModel());
|
|
|
|
placesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
2007-04-14 16:50:51 +00:00
|
|
|
|
2007-06-30 20:10:50 +00:00
|
|
|
placesDock->toggleViewAction()->setText(i18nc("@title:window", "Places"));
|
2007-08-30 06:20:24 +00:00
|
|
|
placesDock->toggleViewAction()->setShortcut(Qt::Key_F9);
|
2007-04-14 16:50:51 +00:00
|
|
|
actionCollection()->addAction("show_places_panel", placesDock->toggleViewAction());
|
|
|
|
|
2007-04-01 22:28:03 +00:00
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
|
2007-10-24 20:28:28 +00:00
|
|
|
connect(placesView, SIGNAL(urlChanged(KUrl)),
|
2007-04-02 08:51:57 +00:00
|
|
|
this, SLOT(changeUrl(KUrl)));
|
|
|
|
connect(this, SIGNAL(urlChanged(KUrl)),
|
2007-10-24 20:28:28 +00:00
|
|
|
placesView, SLOT(setUrl(KUrl)));
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateHistory()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
2007-04-08 21:07:41 +00:00
|
|
|
const int index = urlNavigator->historyIndex();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
QAction* backAction = actionCollection()->action("go_back");
|
|
|
|
if (backAction != 0) {
|
2007-04-08 21:07:41 +00:00
|
|
|
backAction->setEnabled(index < urlNavigator->historySize() - 1);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QAction* forwardAction = actionCollection()->action("go_forward");
|
|
|
|
if (forwardAction != 0) {
|
|
|
|
forwardAction->setEnabled(index > 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateEditActions()
|
|
|
|
{
|
2007-10-02 19:03:03 +00:00
|
|
|
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
|
2007-04-01 18:36:23 +00:00
|
|
|
if (list.isEmpty()) {
|
|
|
|
stateChanged("has_no_selection");
|
2007-04-09 19:12:54 +00:00
|
|
|
} else {
|
2007-04-01 18:36:23 +00:00
|
|
|
stateChanged("has_selection");
|
|
|
|
|
|
|
|
QAction* renameAction = actionCollection()->action("rename");
|
|
|
|
if (renameAction != 0) {
|
2007-11-15 14:59:02 +00:00
|
|
|
renameAction->setEnabled(true);
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool enableMoveToTrash = true;
|
|
|
|
|
2007-10-02 19:03:03 +00:00
|
|
|
KFileItemList::const_iterator it = list.begin();
|
|
|
|
const KFileItemList::const_iterator end = list.end();
|
2007-04-01 18:36:23 +00:00
|
|
|
while (it != end) {
|
2007-08-13 21:57:20 +00:00
|
|
|
const KUrl& url = (*it).url();
|
2007-04-01 18:36:23 +00:00
|
|
|
// only enable the 'Move to Trash' action for local files
|
|
|
|
if (!url.isLocalFile()) {
|
|
|
|
enableMoveToTrash = false;
|
|
|
|
}
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
|
|
|
|
QAction* moveToTrashAction = actionCollection()->action("move_to_trash");
|
|
|
|
moveToTrashAction->setEnabled(enableMoveToTrash);
|
|
|
|
}
|
|
|
|
updatePasteAction();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateViewActions()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
const DolphinView* view = m_activeViewContainer->view();
|
2007-04-01 18:36:23 +00:00
|
|
|
QAction* zoomInAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomIn));
|
|
|
|
if (zoomInAction != 0) {
|
2007-06-07 21:10:48 +00:00
|
|
|
zoomInAction->setEnabled(view->isZoomInPossible());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QAction* zoomOutAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomOut));
|
|
|
|
if (zoomOutAction != 0) {
|
2007-06-07 21:10:48 +00:00
|
|
|
zoomOutAction->setEnabled(view->isZoomOutPossible());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2007-10-10 23:01:35 +00:00
|
|
|
QAction* action = actionCollection()->action(view->currentViewModeActionName());
|
2007-04-01 18:36:23 +00:00
|
|
|
if (action != 0) {
|
|
|
|
KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
|
|
|
|
toggleAction->setChecked(true);
|
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
slotSortingChanged(view->sorting());
|
|
|
|
slotSortOrderChanged(view->sortOrder());
|
2007-04-10 11:22:56 +00:00
|
|
|
slotCategorizedSortingChanged();
|
2007-06-07 21:10:48 +00:00
|
|
|
slotAdditionalInfoChanged(view->additionalInfo());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* showFilterBarAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
2007-06-07 21:10:48 +00:00
|
|
|
showFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* showPreviewAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
|
2007-06-07 21:10:48 +00:00
|
|
|
showPreviewAction->setChecked(view->showPreview());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* showHiddenFilesAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
2007-06-07 21:10:48 +00:00
|
|
|
showHiddenFilesAction->setChecked(view->showHiddenFiles());
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-08-12 17:48:29 +00:00
|
|
|
updateSplitAction();
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
KToggleAction* editableLocactionAction =
|
|
|
|
static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
2007-06-07 21:10:48 +00:00
|
|
|
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
|
|
|
editableLocactionAction->setChecked(urlNavigator->isUrlEditable());
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::updateGoActions()
|
|
|
|
{
|
|
|
|
QAction* goUpAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Up));
|
2007-06-07 21:10:48 +00:00
|
|
|
const KUrl& currentUrl = m_activeViewContainer->url();
|
2007-04-01 18:36:23 +00:00
|
|
|
goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::clearStatusBar()
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
m_activeViewContainer->statusBar()->clear();
|
2007-04-01 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinMainWindow::connectViewSignals(int viewIndex)
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinViewContainer* container = m_viewContainer[viewIndex];
|
|
|
|
connect(container, SIGNAL(showFilterBarChanged(bool)),
|
|
|
|
this, SLOT(updateFilterBarAction(bool)));
|
|
|
|
|
|
|
|
DolphinView* view = container->view();
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(view, SIGNAL(modeChanged()),
|
|
|
|
this, SLOT(slotViewModeChanged()));
|
|
|
|
connect(view, SIGNAL(showPreviewChanged()),
|
|
|
|
this, SLOT(slotShowPreviewChanged()));
|
|
|
|
connect(view, SIGNAL(showHiddenFilesChanged()),
|
|
|
|
this, SLOT(slotShowHiddenFilesChanged()));
|
2007-04-10 11:22:56 +00:00
|
|
|
connect(view, SIGNAL(categorizedSortingChanged()),
|
|
|
|
this, SLOT(slotCategorizedSortingChanged()));
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
|
|
|
|
this, SLOT(slotSortingChanged(DolphinView::Sorting)));
|
|
|
|
connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
|
|
|
|
this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
|
2007-10-01 22:06:49 +00:00
|
|
|
connect(view, SIGNAL(additionalInfoChanged(KFileItemDelegate::InformationList)),
|
|
|
|
this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::InformationList)));
|
2007-10-02 19:03:03 +00:00
|
|
|
connect(view, SIGNAL(selectionChanged(KFileItemList)),
|
|
|
|
this, SLOT(slotSelectionChanged(KFileItemList)));
|
2007-07-02 17:24:54 +00:00
|
|
|
connect(view, SIGNAL(requestItemInfo(KFileItem)),
|
|
|
|
this, SLOT(slotRequestItemInfo(KFileItem)));
|
2007-06-07 21:10:48 +00:00
|
|
|
connect(view, SIGNAL(activated()),
|
|
|
|
this, SLOT(toggleActiveView()));
|
2007-11-15 20:04:05 +00:00
|
|
|
connect(view, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
|
|
|
|
this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
|
2007-04-01 18:36:23 +00:00
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
const KUrlNavigator* navigator = container->urlNavigator();
|
2007-04-01 18:36:23 +00:00
|
|
|
connect(navigator, SIGNAL(urlChanged(const KUrl&)),
|
|
|
|
this, SLOT(changeUrl(const KUrl&)));
|
|
|
|
connect(navigator, SIGNAL(historyChanged()),
|
|
|
|
this, SLOT(slotHistoryChanged()));
|
|
|
|
}
|
2007-04-12 17:37:53 +00:00
|
|
|
|
2007-08-12 17:48:29 +00:00
|
|
|
void DolphinMainWindow::updateSplitAction()
|
2007-06-03 14:07:45 +00:00
|
|
|
{
|
2007-06-03 15:50:52 +00:00
|
|
|
QAction* splitAction = actionCollection()->action("split_view");
|
2007-08-12 17:48:29 +00:00
|
|
|
if (m_viewContainer[SecondaryView] != 0) {
|
|
|
|
if (m_activeViewContainer == m_viewContainer[PrimaryView]) {
|
2007-08-25 09:54:31 +00:00
|
|
|
splitAction->setText(i18nc("@action:intoolbar Close right view", "Close"));
|
|
|
|
splitAction->setIcon(KIcon("fileview-close-right"));
|
2007-08-12 17:48:29 +00:00
|
|
|
} else {
|
2007-08-25 09:54:31 +00:00
|
|
|
splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
|
|
|
|
splitAction->setIcon(KIcon("fileview-close-left"));
|
2007-08-12 17:48:29 +00:00
|
|
|
}
|
2007-06-03 14:07:45 +00:00
|
|
|
} else {
|
2007-06-30 20:10:50 +00:00
|
|
|
splitAction->setText(i18nc("@action:intoolbar Split view", "Split"));
|
2007-06-03 14:07:45 +00:00
|
|
|
splitAction->setIcon(KIcon("fileview-split"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-02 22:04:36 +00:00
|
|
|
void DolphinMainWindow::toggleAdditionalInfo(const char* actionName,
|
|
|
|
KFileItemDelegate::Information info)
|
|
|
|
{
|
|
|
|
clearStatusBar();
|
|
|
|
|
|
|
|
DolphinView* view = m_activeViewContainer->view();
|
|
|
|
KFileItemDelegate::InformationList list = view->additionalInfo();
|
|
|
|
|
|
|
|
const bool show = actionCollection()->action(actionName)->isChecked();
|
|
|
|
|
|
|
|
const int index = list.indexOf(info);
|
|
|
|
const bool containsInfo = (index >= 0);
|
|
|
|
if (show && !containsInfo) {
|
|
|
|
list.append(info);
|
|
|
|
view->setAdditionalInfo(list);
|
|
|
|
} else if (!show && containsInfo) {
|
|
|
|
list.removeAt(index);
|
|
|
|
view->setAdditionalInfo(list);
|
|
|
|
Q_ASSERT(list.indexOf(info) < 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-01 18:36:23 +00:00
|
|
|
DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
|
2007-11-15 10:10:42 +00:00
|
|
|
KonqFileUndoManager::UiInterface(mainWin),
|
2007-04-12 17:37:53 +00:00
|
|
|
m_mainWin(mainWin)
|
2007-04-01 18:36:23 +00:00
|
|
|
{
|
|
|
|
Q_ASSERT(m_mainWin != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
|
2007-04-12 17:37:53 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-01 18:36:23 +00:00
|
|
|
|
|
|
|
void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
|
|
|
|
{
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
|
2007-04-01 18:36:23 +00:00
|
|
|
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "dolphinmainwindow.moc"
|