First big step to make it possible that the DolphinView can be embedded as KPart into Konqueror (discussed with David Faure). A lot of refactoring of the DolphinView has been done:

- The DolphinView does not contain the URL navigator, the filterbar and the statusbar anymore. Those widgets have been moved to DolphinViewContainer.
- The DolphinView does not contain any reference to the main window anymore.

Currently there are some minor regressions (the statusbar shows less informations, renaming has been deactivated), but they will get fixed during the next days. Also still a lot of interface cleanups must be done, but let's just do it step by step...

svn path=/trunk/KDE/kdebase/apps/; revision=672692
This commit is contained in:
Peter Penz 2007-06-07 21:10:48 +00:00
parent 5de9950182
commit be9746e87b
19 changed files with 1308 additions and 881 deletions

View file

@ -50,6 +50,7 @@ set(dolphin_SRCS
dolphinmainwindow.cpp
dolphinnewmenu.cpp
dolphinview.cpp
dolphinviewcontainer.cpp
dolphinstatusbar.cpp
dolphindirlister.cpp
dolphincontextmenu.cpp

View file

@ -20,6 +20,7 @@
#include "dolphinapplication.h"
#include "dolphinmainwindow.h"
#include "dolphinviewcontainer.h"
#include <applicationadaptor.h>
#include <kcmdlineargs.h>
@ -90,8 +91,8 @@ int DolphinApplication::newInstance()
int DolphinApplication::openWindow(const KUrl& url)
{
DolphinMainWindow* win = createMainWindow();
if ((win->activeView() != 0) && url.isValid()) {
win->activeView()->setUrl(url);
if ((win->activeViewContainer() != 0) && url.isValid()) {
win->activeViewContainer()->setUrl(url);
}
win->show();
return win->getId();

View file

@ -88,10 +88,10 @@ void DolphinColumnView::contextMenuEvent(QContextMenuEvent* event)
m_controller->triggerContextMenuRequest(event->pos());
}
void DolphinColumnView::mouseReleaseEvent(QMouseEvent* event)
void DolphinColumnView::mousePressEvent(QMouseEvent* event)
{
QColumnView::mouseReleaseEvent(event);
m_controller->triggerActivation();
QColumnView::mousePressEvent(event);
}
void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event)

View file

@ -39,7 +39,7 @@ public:
protected:
virtual QStyleOptionViewItem viewOptions() const;
virtual void contextMenuEvent(QContextMenuEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dropEvent(QDropEvent* event);

View file

@ -23,6 +23,7 @@
#include "dolphinmainwindow.h"
#include "dolphinsettings.h"
#include "dolphinview.h"
#include "dolphinviewcontainer.h"
#include <kactioncollection.h>
#include <kfileplacesmodel.h>
@ -57,7 +58,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
{
// The context menu either accesses the URLs of the selected items
// or the items itself. To increase the performance both lists are cached.
DolphinView* view = m_mainWindow->activeView();
DolphinView* view = m_mainWindow->activeViewContainer()->view();
m_selectedUrls = view->selectedUrls();
m_selectedItems = view->selectedItems();
}
@ -242,11 +243,11 @@ void DolphinContextMenu::openViewportContextMenu()
QAction* activatedAction = popup->exec(QCursor::pos());
if (activatedAction == propertiesAction) {
const KUrl& url = m_mainWindow->activeView()->url();
const KUrl& url = m_mainWindow->activeViewContainer()->url();
KPropertiesDialog dialog(url);
dialog.exec();
} else if (activatedAction == bookmarkAction) {
const KUrl& url = m_mainWindow->activeView()->url();
const KUrl& url = m_mainWindow->activeViewContainer()->url();
if (url.isValid()) {
DolphinSettings::instance().placesModel()->addPlace(url.fileName(), url);
}
@ -278,7 +279,7 @@ void DolphinContextMenu::insertDefaultItemActions(KMenu* popup)
const KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
const KConfigGroup kdeConfig(globalConfig, "KDE");
bool showDeleteCommand = kdeConfig.readEntry("ShowDeleteCommand", false);
const KUrl& url = m_mainWindow->activeView()->url();
const KUrl& url = m_mainWindow->activeViewContainer()->url();
if (url.isLocalFile()) {
QAction* moveToTrashAction = collection->action("move_to_trash");
popup->addAction(moveToTrashAction);

View file

@ -155,6 +155,8 @@ void DolphinDetailsView::contextMenuEvent(QContextMenuEvent* event)
void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
{
m_controller->triggerActivation();
QTreeView::mousePressEvent(event);
const QModelIndex index = indexAt(event->pos());
@ -191,7 +193,6 @@ void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event)
updateElasticBand();
m_showElasticBand = false;
}
m_controller->triggerActivation();
}
void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event)

View file

@ -106,6 +106,7 @@ void DolphinIconsView::contextMenuEvent(QContextMenuEvent* event)
void DolphinIconsView::mousePressEvent(QMouseEvent* event)
{
m_controller->triggerActivation();
if (!indexAt(event->pos()).isValid()) {
const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
if (!(modifier & Qt::ShiftModifier) && !(modifier & Qt::ControlModifier)) {
@ -116,12 +117,6 @@ void DolphinIconsView::mousePressEvent(QMouseEvent* event)
KListView::mousePressEvent(event);
}
void DolphinIconsView::mouseReleaseEvent(QMouseEvent* event)
{
KListView::mouseReleaseEvent(event);
m_controller->triggerActivation();
}
void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls()) {

View file

@ -45,7 +45,6 @@ protected:
virtual QStyleOptionViewItem viewOptions() const;
virtual void contextMenuEvent(QContextMenuEvent* event);
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void dragEnterEvent(QDragEnterEvent* event);
virtual void dragLeaveEvent(QDragLeaveEvent* event);
virtual void dragMoveEvent(QDragMoveEvent* event);

View file

@ -28,6 +28,7 @@
#include "dolphinsettings.h"
#include "dolphinsettingsdialog.h"
#include "dolphinstatusbar.h"
#include "dolphinviewcontainer.h"
#include "infosidebarpage.h"
#include "metadatawidget.h"
#include "mainwindowadaptor.h"
@ -78,12 +79,12 @@ DolphinMainWindow::DolphinMainWindow(int id) :
KXmlGuiWindow(0),
m_newMenu(0),
m_splitter(0),
m_activeView(0),
m_activeViewContainer(0),
m_id(id)
{
setObjectName("Dolphin");
m_view[PrimaryIdx] = 0;
m_view[SecondaryIdx] = 0;
m_viewContainer[PrimaryIdx] = 0;
m_viewContainer[SecondaryIdx] = 0;
new MainWindowAdaptor(this);
QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id), this);
@ -105,21 +106,23 @@ DolphinMainWindow::~DolphinMainWindow()
DolphinApplication::app()->removeMainWindow(this);
}
void DolphinMainWindow::setActiveView(DolphinView* view)
void DolphinMainWindow::setActiveView(DolphinViewContainer* view)
{
Q_ASSERT((view == m_view[PrimaryIdx]) || (view == m_view[SecondaryIdx]));
if (m_activeView == view) {
Q_ASSERT((view == m_viewContainer[PrimaryIdx]) || (view == m_viewContainer[SecondaryIdx]));
if (m_activeViewContainer == view) {
return;
}
m_activeView = view;
m_activeViewContainer->setActive(false);
m_activeViewContainer = view;
m_activeViewContainer->setActive(true);
updateHistory();
updateEditActions();
updateViewActions();
updateGoActions();
setCaption(m_activeView->url().fileName());
setCaption(m_activeViewContainer->url().fileName());
emit activeViewChanged();
}
@ -207,25 +210,25 @@ void DolphinMainWindow::rename(const KUrl& oldUrl, const KUrl& newUrl)
void DolphinMainWindow::refreshViews()
{
Q_ASSERT(m_view[PrimaryIdx] != 0);
Q_ASSERT(m_viewContainer[PrimaryIdx] != 0);
// remember the current active view, as because of
// the refreshing the active view might change to
// the secondary view
DolphinView* activeView = m_activeView;
DolphinViewContainer* activeViewContainer = m_activeViewContainer;
m_view[PrimaryIdx]->refresh();
if (m_view[SecondaryIdx] != 0) {
m_view[SecondaryIdx]->refresh();
m_viewContainer[PrimaryIdx]->view()->refresh();
if (m_viewContainer[SecondaryIdx] != 0) {
m_viewContainer[SecondaryIdx]->view()->refresh();
}
setActiveView(activeView);
setActiveView(activeViewContainer);
}
void DolphinMainWindow::changeUrl(const KUrl& url)
{
if (activeView() != 0) {
activeView()->setUrl(url);
if (activeViewContainer() != 0) {
activeViewContainer()->setUrl(url);
updateEditActions();
updateViewActions();
updateGoActions();
@ -236,7 +239,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
void DolphinMainWindow::changeSelection(const KFileItemList& selection)
{
activeView()->changeSelection(selection);
activeViewContainer()->view()->changeSelection(selection);
}
void DolphinMainWindow::slotViewModeChanged()
@ -255,15 +258,17 @@ void DolphinMainWindow::slotShowHiddenFilesChanged()
{
KToggleAction* showHiddenFilesAction =
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
showHiddenFilesAction->setChecked(m_activeView->showHiddenFiles());
const DolphinView* view = m_activeViewContainer->view();
showHiddenFilesAction->setChecked(view->showHiddenFiles());
}
void DolphinMainWindow::slotCategorizedSortingChanged()
{
KToggleAction* categorizedSortingAction =
static_cast<KToggleAction*>(actionCollection()->action("categorized"));
categorizedSortingAction->setChecked(m_activeView->categorizedSorting());
categorizedSortingAction->setEnabled(m_activeView->supportsCategorizedSorting());
const DolphinView* view = m_activeViewContainer->view();
categorizedSortingAction->setChecked(view->categorizedSorting());
categorizedSortingAction->setEnabled(view->supportsCategorizedSorting());
}
void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting)
@ -332,7 +337,8 @@ void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::AdditionalI
QActionGroup* group = toggleAction->actionGroup();
Q_ASSERT(group != 0);
group->setEnabled(m_activeView->mode() == DolphinView::IconsView);
const DolphinView* view = m_activeViewContainer->view();
group->setEnabled(view->mode() == DolphinView::IconsView);
}
}
@ -340,16 +346,16 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
{
updateEditActions();
Q_ASSERT(m_view[PrimaryIdx] != 0);
int selectedUrlsCount = m_view[PrimaryIdx]->selectedUrls().count();
if (m_view[SecondaryIdx] != 0) {
selectedUrlsCount += m_view[SecondaryIdx]->selectedUrls().count();
Q_ASSERT(m_viewContainer[PrimaryIdx] != 0);
int selectedUrlsCount = m_viewContainer[PrimaryIdx]->view()->selectedUrls().count();
if (m_viewContainer[SecondaryIdx] != 0) {
selectedUrlsCount += m_viewContainer[SecondaryIdx]->view()->selectedUrls().count();
}
QAction* compareFilesAction = actionCollection()->action("compare_files");
compareFilesAction->setEnabled(selectedUrlsCount == 2);
m_activeView->updateStatusBar();
m_activeViewContainer->updateStatusBar();
emit selectionChanged(selection);
}
@ -376,6 +382,15 @@ void DolphinMainWindow::openNewMainWindow()
DolphinApplication::app()->createMainWindow()->show();
}
void DolphinMainWindow::toggleActiveView()
{
if (m_activeViewContainer == m_viewContainer[PrimaryIdx]) {
setActiveView(m_viewContainer[SecondaryIdx]);
} else {
setActiveView(m_viewContainer[PrimaryIdx]);
}
}
void DolphinMainWindow::closeEvent(QCloseEvent* event)
{
DolphinSettings& settings = DolphinSettings::instance();
@ -390,28 +405,31 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
void DolphinMainWindow::saveProperties(KConfig* config)
{
KConfigGroup primaryView = config->group("Primary view");
primaryView.writeEntry("Url", m_view[PrimaryIdx]->url().url());
primaryView.writeEntry("Editable Url", m_view[PrimaryIdx]->isUrlEditable());
if (m_view[SecondaryIdx] != 0) {
primaryView.writeEntry("Url", m_viewContainer[PrimaryIdx]->url().url());
primaryView.writeEntry("Editable Url", m_viewContainer[PrimaryIdx]->isUrlEditable());
if (m_viewContainer[SecondaryIdx] != 0) {
KConfigGroup secondaryView = config->group("Secondary view");
secondaryView.writeEntry("Url", m_view[SecondaryIdx]->url().url());
secondaryView.writeEntry("Editable Url", m_view[SecondaryIdx]->isUrlEditable());
secondaryView.writeEntry("Url", m_viewContainer[SecondaryIdx]->url().url());
secondaryView.writeEntry("Editable Url", m_viewContainer[SecondaryIdx]->isUrlEditable());
}
}
void DolphinMainWindow::readProperties(KConfig* config)
{
const KConfigGroup primaryView = config->group("Primary view");
m_view[PrimaryIdx]->setUrl(primaryView.readEntry("Url"));
m_view[PrimaryIdx]->setUrlEditable(primaryView.readEntry("Editable Url", false));
const KConfigGroup primaryViewGroup = config->group("Primary view");
m_viewContainer[PrimaryIdx]->setUrl(primaryViewGroup.readEntry("Url"));
bool editable = primaryViewGroup.readEntry("Editable Url", false);
m_viewContainer[PrimaryIdx]->urlNavigator()->setUrlEditable(editable);
if (config->hasGroup("Secondary view")) {
const KConfigGroup secondaryView = config->group("Secondary view");
if (m_view[SecondaryIdx] == 0) {
const KConfigGroup secondaryViewGroup = config->group("Secondary view");
if (m_viewContainer[PrimaryIdx] == 0) {
toggleSplitView();
}
m_view[SecondaryIdx]->setUrl(secondaryView.readEntry("Url"));
m_view[SecondaryIdx]->setUrlEditable(secondaryView.readEntry("Editable Url", false));
} else if (m_view[SecondaryIdx] != 0) {
m_viewContainer[PrimaryIdx]->setUrl(secondaryViewGroup.readEntry("Url"));
editable = secondaryViewGroup.readEntry("Editable Url", false);
m_viewContainer[PrimaryIdx]->urlNavigator()->setUrlEditable(editable);
} else if (m_viewContainer[SecondaryIdx] != 0) {
toggleSplitView();
}
}
@ -419,19 +437,19 @@ void DolphinMainWindow::readProperties(KConfig* config)
void DolphinMainWindow::updateNewMenu()
{
m_newMenu->slotCheckUpToDate();
m_newMenu->setPopupFiles(activeView()->url());
m_newMenu->setPopupFiles(activeViewContainer()->url());
}
void DolphinMainWindow::rename()
{
clearStatusBar();
m_activeView->renameSelectedItems();
m_activeViewContainer->renameSelectedItems();
}
void DolphinMainWindow::moveToTrash()
{
clearStatusBar();
const KUrl::List selectedUrls = m_activeView->selectedUrls();
const KUrl::List selectedUrls = m_activeViewContainer->view()->selectedUrls();
KonqOperations::del(this, KonqOperations::TRASH, selectedUrls);
m_undoCommandTypes.append(KonqUndoManager::TRASH);
}
@ -440,7 +458,7 @@ void DolphinMainWindow::deleteItems()
{
clearStatusBar();
const KUrl::List list = m_activeView->selectedUrls();
const KUrl::List list = m_activeViewContainer->view()->selectedUrls();
const bool del = KonqOperations::askDeleteConfirmation(list,
KonqOperations::DEL,
KonqOperations::DEFAULT_CONFIRMATION,
@ -457,7 +475,7 @@ void DolphinMainWindow::deleteItems()
void DolphinMainWindow::properties()
{
const KFileItemList list = m_activeView->selectedItems();
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
KPropertiesDialog dialog(list, this);
dialog.exec();
}
@ -470,7 +488,7 @@ void DolphinMainWindow::quit()
void DolphinMainWindow::slotHandleJobError(KJob* job)
{
if (job->error() != 0) {
DolphinStatusBar* statusBar = m_activeView->statusBar();
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
statusBar->setMessage(job->errorString(),
DolphinStatusBar::Error);
}
@ -479,7 +497,7 @@ void DolphinMainWindow::slotHandleJobError(KJob* job)
void DolphinMainWindow::slotDeleteFileFinished(KJob* job)
{
if (job->error() == 0) {
DolphinStatusBar* statusBar = m_activeView->statusBar();
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
statusBar->setMessage(i18n("Delete operation completed."),
DolphinStatusBar::OperationCompleted);
}
@ -494,7 +512,7 @@ void DolphinMainWindow::slotUndoAvailable(bool available)
if (available && (m_undoCommandTypes.count() > 0)) {
const KonqUndoManager::CommandType command = m_undoCommandTypes.takeFirst();
DolphinStatusBar* statusBar = m_activeView->statusBar();
DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
switch (command) {
case KonqUndoManager::COPY:
statusBar->setMessage(i18n("Copy operation completed."),
@ -546,7 +564,7 @@ void DolphinMainWindow::undo()
void DolphinMainWindow::cut()
{
QMimeData* mimeData = new QMimeData();
const KUrl::List kdeUrls = m_activeView->selectedUrls();
const KUrl::List kdeUrls = m_activeViewContainer->view()->selectedUrls();
const KUrl::List mostLocalUrls;
KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, true);
QApplication::clipboard()->setMimeData(mimeData);
@ -555,7 +573,7 @@ void DolphinMainWindow::cut()
void DolphinMainWindow::copy()
{
QMimeData* mimeData = new QMimeData();
const KUrl::List kdeUrls = m_activeView->selectedUrls();
const KUrl::List kdeUrls = m_activeViewContainer->view()->selectedUrls();
const KUrl::List mostLocalUrls;
KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, false);
@ -572,10 +590,10 @@ void DolphinMainWindow::paste()
const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData);
// per default the pasting is done into the current Url of the view
KUrl destUrl(m_activeView->url());
KUrl destUrl(m_activeViewContainer->url());
// check whether the pasting should be done into a selected directory
KUrl::List selectedUrls = m_activeView->selectedUrls();
KUrl::List selectedUrls = m_activeViewContainer->view()->selectedUrls();
if (selectedUrls.count() == 1) {
const KFileItem fileItem(S_IFDIR,
KFileItem::Unknown,
@ -618,7 +636,7 @@ void DolphinMainWindow::updatePasteAction()
}
if (pasteAction->isEnabled()) {
KUrl::List urls = m_activeView->selectedUrls();
KUrl::List urls = m_activeViewContainer->view()->selectedUrls();
const uint count = urls.count();
if (count > 1) {
// pasting should not be allowed when more than one file
@ -628,7 +646,7 @@ void DolphinMainWindow::updatePasteAction()
// Only one file is selected. Pasting is only allowed if this
// file is a directory.
// TODO: this doesn't work with remote protocols; instead we need a
// m_activeView->selectedFileItems() to get the real KFileItems
// m_activeViewContainer->selectedFileItems() to get the real KFileItems
const KFileItem fileItem(S_IFDIR,
KFileItem::Unknown,
urls.first(),
@ -641,130 +659,134 @@ void DolphinMainWindow::updatePasteAction()
void DolphinMainWindow::selectAll()
{
clearStatusBar();
m_activeView->selectAll();
m_activeViewContainer->view()->selectAll();
}
void DolphinMainWindow::invertSelection()
{
clearStatusBar();
m_activeView->invertSelection();
m_activeViewContainer->view()->invertSelection();
}
void DolphinMainWindow::setIconsView()
{
m_activeView->setMode(DolphinView::IconsView);
m_activeViewContainer->view()->setMode(DolphinView::IconsView);
}
void DolphinMainWindow::setDetailsView()
{
m_activeView->setMode(DolphinView::DetailsView);
m_activeViewContainer->view()->setMode(DolphinView::DetailsView);
}
void DolphinMainWindow::setColumnView()
{
m_activeView->setMode(DolphinView::ColumnView);
m_activeViewContainer->view()->setMode(DolphinView::ColumnView);
}
void DolphinMainWindow::sortByName()
{
m_activeView->setSorting(DolphinView::SortByName);
m_activeViewContainer->view()->setSorting(DolphinView::SortByName);
}
void DolphinMainWindow::sortBySize()
{
m_activeView->setSorting(DolphinView::SortBySize);
m_activeViewContainer->view()->setSorting(DolphinView::SortBySize);
}
void DolphinMainWindow::sortByDate()
{
m_activeView->setSorting(DolphinView::SortByDate);
m_activeViewContainer->view()->setSorting(DolphinView::SortByDate);
}
void DolphinMainWindow::sortByPermissions()
{
m_activeView->setSorting(DolphinView::SortByPermissions);
m_activeViewContainer->view()->setSorting(DolphinView::SortByPermissions);
}
void DolphinMainWindow::sortByOwner()
{
m_activeView->setSorting(DolphinView::SortByOwner);
m_activeViewContainer->view()->setSorting(DolphinView::SortByOwner);
}
void DolphinMainWindow::sortByGroup()
{
m_activeView->setSorting(DolphinView::SortByGroup);
m_activeViewContainer->view()->setSorting(DolphinView::SortByGroup);
}
void DolphinMainWindow::sortByType()
{
m_activeView->setSorting(DolphinView::SortByType);
m_activeViewContainer->view()->setSorting(DolphinView::SortByType);
}
void DolphinMainWindow::toggleSortOrder()
{
const Qt::SortOrder order = (m_activeView->sortOrder() == Qt::AscendingOrder) ?
DolphinView* view = m_activeViewContainer->view();
const Qt::SortOrder order = (view->sortOrder() == Qt::AscendingOrder) ?
Qt::DescendingOrder :
Qt::AscendingOrder;
m_activeView->setSortOrder(order);
view->setSortOrder(order);
}
void DolphinMainWindow::toggleSortCategorization()
{
const bool categorizedSorting = m_activeView->categorizedSorting();
m_activeView->setCategorizedSorting(!categorizedSorting);
DolphinView* view = m_activeViewContainer->view();
const bool categorizedSorting = view->categorizedSorting();
view->setCategorizedSorting(!categorizedSorting);
}
void DolphinMainWindow::clearInfo()
{
m_activeView->setAdditionalInfo(KFileItemDelegate::NoInformation);
m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::NoInformation);
}
void DolphinMainWindow::showMimeInfo()
{
clearStatusBar();
m_activeView->setAdditionalInfo(KFileItemDelegate::FriendlyMimeType);
m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::FriendlyMimeType);
}
void DolphinMainWindow::showSizeInfo()
{
clearStatusBar();
m_activeView->setAdditionalInfo(KFileItemDelegate::Size);
m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::Size);
}
void DolphinMainWindow::showDateInfo()
{
clearStatusBar();
m_activeView->setAdditionalInfo(KFileItemDelegate::ModificationTime);
m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::ModificationTime);
}
void DolphinMainWindow::toggleSplitView()
{
if (m_view[SecondaryIdx] == 0) {
const int newWidth = (m_view[PrimaryIdx]->width() - m_splitter->handleWidth()) / 2;
if (m_viewContainer[SecondaryIdx] == 0) {
const int newWidth = (m_viewContainer[PrimaryIdx]->width() - m_splitter->handleWidth()) / 2;
// create a secondary view
m_view[SecondaryIdx] = new DolphinView(this,
0,
m_view[PrimaryIdx]->rootUrl(),
m_view[PrimaryIdx]->mode(),
m_view[PrimaryIdx]->showHiddenFiles());
const DolphinView* view = m_viewContainer[PrimaryIdx]->view();
m_viewContainer[SecondaryIdx] = new DolphinViewContainer(this,
0,
view->rootUrl(),
view->mode(),
view->showHiddenFiles());
connectViewSignals(SecondaryIdx);
m_splitter->addWidget(m_view[SecondaryIdx]);
m_splitter->addWidget(m_viewContainer[SecondaryIdx]);
m_splitter->setSizes(QList<int>() << newWidth << newWidth);
m_view[SecondaryIdx]->reload();
m_view[SecondaryIdx]->show();
m_viewContainer[SecondaryIdx]->view()->reload();
m_viewContainer[SecondaryIdx]->setActive(false);
m_viewContainer[SecondaryIdx]->show();
} else {
// remove secondary view
m_view[SecondaryIdx]->close();
m_view[SecondaryIdx]->deleteLater();
m_view[SecondaryIdx] = 0;
m_viewContainer[SecondaryIdx]->close();
m_viewContainer[SecondaryIdx]->deleteLater();
m_viewContainer[SecondaryIdx] = 0;
}
setActiveView(m_view[PrimaryIdx]);
setActiveView(m_viewContainer[PrimaryIdx]);
emit activeViewChanged();
}
void DolphinMainWindow::reloadView()
{
clearStatusBar();
m_activeView->reload();
m_activeViewContainer->view()->reload();
}
void DolphinMainWindow::stopLoading()
@ -777,7 +799,7 @@ void DolphinMainWindow::togglePreview()
const KToggleAction* showPreviewAction =
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
const bool show = showPreviewAction->isChecked();
m_activeView->setShowPreview(show);
m_activeViewContainer->view()->setShowPreview(show);
}
void DolphinMainWindow::toggleShowHiddenFiles()
@ -787,7 +809,7 @@ void DolphinMainWindow::toggleShowHiddenFiles()
const KToggleAction* showHiddenFilesAction =
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
const bool show = showHiddenFilesAction->isChecked();
m_activeView->setShowHiddenFiles(show);
m_activeViewContainer->view()->setShowHiddenFiles(show);
}
void DolphinMainWindow::toggleFilterBarVisibility()
@ -795,18 +817,18 @@ void DolphinMainWindow::toggleFilterBarVisibility()
const KToggleAction* showFilterBarAction =
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
const bool show = showFilterBarAction->isChecked();
m_activeView->showFilterBar(show);
m_activeViewContainer->showFilterBar(show);
}
void DolphinMainWindow::zoomIn()
{
m_activeView->zoomIn();
m_activeViewContainer->view()->zoomIn();
updateViewActions();
}
void DolphinMainWindow::zoomOut()
{
m_activeView->zoomOut();
m_activeViewContainer->view()->zoomOut();
updateViewActions();
}
@ -817,48 +839,49 @@ void DolphinMainWindow::toggleEditLocation()
KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
bool editOrBrowse = action->isChecked();
m_activeView->setUrlEditable(editOrBrowse);
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
urlNavigator->setUrlEditable(editOrBrowse);
}
void DolphinMainWindow::editLocation()
{
m_activeView->setUrlEditable(true);
m_activeViewContainer->urlNavigator()->setUrlEditable(true);
}
void DolphinMainWindow::adjustViewProperties()
{
clearStatusBar();
ViewPropertiesDialog dlg(m_activeView);
ViewPropertiesDialog dlg(m_activeViewContainer->view());
dlg.exec();
}
void DolphinMainWindow::goBack()
{
clearStatusBar();
m_activeView->goBack();
m_activeViewContainer->urlNavigator()->goBack();
}
void DolphinMainWindow::goForward()
{
clearStatusBar();
m_activeView->goForward();
m_activeViewContainer->urlNavigator()->goForward();
}
void DolphinMainWindow::goUp()
{
clearStatusBar();
m_activeView->goUp();
m_activeViewContainer->urlNavigator()->goUp();
}
void DolphinMainWindow::goHome()
{
clearStatusBar();
m_activeView->goHome();
m_activeViewContainer->urlNavigator()->goHome();
}
void DolphinMainWindow::findFile()
{
KRun::run("kfind", m_activeView->url(), this);
KRun::run("kfind", m_activeViewContainer->url(), this);
}
void DolphinMainWindow::compareFiles()
@ -869,16 +892,16 @@ void DolphinMainWindow::compareFiles()
// - both in the secondary view
// - one in the primary view and the other in the secondary
// view
Q_ASSERT(m_view[PrimaryIdx] != 0);
Q_ASSERT(m_viewContainer[PrimaryIdx] != 0);
KUrl urlA;
KUrl urlB;
KUrl::List urls = m_view[PrimaryIdx]->selectedUrls();
KUrl::List urls = m_viewContainer[PrimaryIdx]->view()->selectedUrls();
switch (urls.count()) {
case 0: {
Q_ASSERT(m_view[SecondaryIdx] != 0);
urls = m_view[SecondaryIdx]->selectedUrls();
Q_ASSERT(m_viewContainer[SecondaryIdx] != 0);
urls = m_viewContainer[SecondaryIdx]->view()->selectedUrls();
Q_ASSERT(urls.count() == 2);
urlA = urls[0];
urlB = urls[1];
@ -887,8 +910,8 @@ void DolphinMainWindow::compareFiles()
case 1: {
urlA = urls[0];
Q_ASSERT(m_view[SecondaryIdx] != 0);
urls = m_view[SecondaryIdx]->selectedUrls();
Q_ASSERT(m_viewContainer[SecondaryIdx] != 0);
urls = m_viewContainer[SecondaryIdx]->view()->selectedUrls();
Q_ASSERT(urls.count() == 1);
urlB = urls[0];
break;
@ -943,16 +966,16 @@ void DolphinMainWindow::init()
const KUrl& homeUrl = settings.generalSettings()->homeUrl();
setCaption(homeUrl.fileName());
ViewProperties props(homeUrl);
m_view[PrimaryIdx] = new DolphinView(this,
m_splitter,
homeUrl,
props.viewMode(),
props.showHiddenFiles());
m_viewContainer[PrimaryIdx] = new DolphinViewContainer(this,
m_splitter,
homeUrl,
props.viewMode(),
props.showHiddenFiles());
m_activeView = m_view[PrimaryIdx];
m_activeViewContainer = m_viewContainer[PrimaryIdx];
connectViewSignals(PrimaryIdx);
m_view[PrimaryIdx]->reload();
m_view[PrimaryIdx]->show();
m_viewContainer[PrimaryIdx]->view()->reload();
m_viewContainer[PrimaryIdx]->show();
setCentralWidget(m_splitter);
setupDockWidgets();
@ -973,11 +996,11 @@ void DolphinMainWindow::init()
if (firstRun) {
// assure a proper default size if Dolphin runs the first time
resize(640, 480);
resize(700, 500);
}
#ifdef HAVE_KMETADATA
if (!MetaDataWidget::metaDataAvailable())
activeView()->statusBar()->setMessage(i18n("Failed to contact Nepomuk service, annotation and tagging are disabled."), DolphinStatusBar::Error);
activeViewContainer()->statusBar()->setMessage(i18n("Failed to contact Nepomuk service, annotation and tagging are disabled."), DolphinStatusBar::Error);
#endif
emit urlChanged(homeUrl);
@ -1299,7 +1322,7 @@ void DolphinMainWindow::setupDockWidgets()
void DolphinMainWindow::updateHistory()
{
const KUrlNavigator* urlNavigator = m_activeView->urlNavigator();
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
const int index = urlNavigator->historyIndex();
QAction* backAction = actionCollection()->action("go_back");
@ -1315,7 +1338,7 @@ void DolphinMainWindow::updateHistory()
void DolphinMainWindow::updateEditActions()
{
const KFileItemList list = m_activeView->selectedItems();
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
stateChanged("has_no_selection");
} else {
@ -1348,18 +1371,19 @@ void DolphinMainWindow::updateEditActions()
void DolphinMainWindow::updateViewActions()
{
const DolphinView* view = m_activeViewContainer->view();
QAction* zoomInAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomIn));
if (zoomInAction != 0) {
zoomInAction->setEnabled(m_activeView->isZoomInPossible());
zoomInAction->setEnabled(view->isZoomInPossible());
}
QAction* zoomOutAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::ZoomOut));
if (zoomOutAction != 0) {
zoomOutAction->setEnabled(m_activeView->isZoomOutPossible());
zoomOutAction->setEnabled(view->isZoomOutPossible());
}
QAction* action = 0;
switch (m_activeView->mode()) {
switch (view->mode()) {
case DolphinView::IconsView:
action = actionCollection()->action("icons");
break;
@ -1378,34 +1402,35 @@ void DolphinMainWindow::updateViewActions()
toggleAction->setChecked(true);
}
slotSortingChanged(m_activeView->sorting());
slotSortOrderChanged(m_activeView->sortOrder());
slotSortingChanged(view->sorting());
slotSortOrderChanged(view->sortOrder());
slotCategorizedSortingChanged();
slotAdditionalInfoChanged(m_activeView->additionalInfo());
slotAdditionalInfoChanged(view->additionalInfo());
KToggleAction* showFilterBarAction =
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
showFilterBarAction->setChecked(m_activeView->isFilterBarVisible());
showFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible());
KToggleAction* showPreviewAction =
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
showPreviewAction->setChecked(m_activeView->showPreview());
showPreviewAction->setChecked(view->showPreview());
KToggleAction* showHiddenFilesAction =
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
showHiddenFilesAction->setChecked(m_activeView->showHiddenFiles());
showHiddenFilesAction->setChecked(view->showHiddenFiles());
updateSplitAction(m_view[SecondaryIdx] != 0);
updateSplitAction(m_viewContainer[SecondaryIdx] != 0);
KToggleAction* editableLocactionAction =
static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
editableLocactionAction->setChecked(m_activeView->isUrlEditable());
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
editableLocactionAction->setChecked(urlNavigator->isUrlEditable());
}
void DolphinMainWindow::updateGoActions()
{
QAction* goUpAction = actionCollection()->action(KStandardAction::stdName(KStandardAction::Up));
const KUrl& currentUrl = m_activeView->url();
const KUrl& currentUrl = m_activeViewContainer->url();
goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
}
@ -1429,12 +1454,16 @@ void DolphinMainWindow::linkUrls(const KUrl::List& source, const KUrl& dest)
void DolphinMainWindow::clearStatusBar()
{
m_activeView->statusBar()->clear();
m_activeViewContainer->statusBar()->clear();
}
void DolphinMainWindow::connectViewSignals(int viewIndex)
{
DolphinView* view = m_view[viewIndex];
DolphinViewContainer* container = m_viewContainer[viewIndex];
connect(container, SIGNAL(showFilterBarChanged(bool)),
this, SLOT(updateFilterBarAction(bool)));
DolphinView* view = container->view();
connect(view, SIGNAL(modeChanged()),
this, SLOT(slotViewModeChanged()));
connect(view, SIGNAL(showPreviewChanged()),
@ -1453,12 +1482,10 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
this, SLOT(slotSelectionChanged(KFileItemList)));
connect(view, SIGNAL(requestItemInfo(KUrl)),
this, SLOT(slotRequestItemInfo(KUrl)));
connect(view, SIGNAL(showFilterBarChanged(bool)),
this, SLOT(updateFilterBarAction(bool)));
connect(view, SIGNAL(urlChanged(KUrl)),
this, SLOT(changeUrl(KUrl)));
connect(view, SIGNAL(activated()),
this, SLOT(toggleActiveView()));
const KUrlNavigator* navigator = view->urlNavigator();
const KUrlNavigator* navigator = container->urlNavigator();
connect(navigator, SIGNAL(urlChanged(const KUrl&)),
this, SLOT(changeUrl(const KUrl&)));
connect(navigator, SIGNAL(historyChanged()),
@ -1490,7 +1517,7 @@ DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
{
DolphinStatusBar* statusBar = m_mainWin->activeView()->statusBar();
DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
}

View file

@ -32,6 +32,7 @@
#include <QtCore/QList>
class DolphinApplication;
class DolphinViewContainer;
class KNewMenu;
class KUrl;
class QSplitter;
@ -52,20 +53,20 @@ public:
virtual ~DolphinMainWindow();
/**
* 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 setActiveView(DolphinView* view);
* 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 setActiveView(DolphinViewContainer* view);
/**
* Returns the currently active view. See
* DolphinMainWindow::setActiveView() for more details.
*/
DolphinView* activeView() const
DolphinViewContainer* activeViewContainer() const
{
return m_activeView;
return m_activeViewContainer;
}
/** Renames the item represented by \a oldUrl to \a newUrl. */
@ -406,6 +407,9 @@ private slots:
/** Open a new main window. */
void openNewMainWindow();
/** Toggles the active view if two views are shown within the main window. */
void toggleActiveView();
private:
DolphinMainWindow(int id);
void init();
@ -468,10 +472,10 @@ class UndoUiInterface : public KonqUndoManager::UiInterface
KNewMenu* m_newMenu;
QSplitter* m_splitter;
DolphinView* m_activeView;
DolphinViewContainer* m_activeViewContainer;
int m_id;
DolphinView* m_view[SecondaryIdx + 1];
DolphinViewContainer* m_viewContainer[SecondaryIdx + 1];
/// remember pending undo operations until they are finished
QList<KonqUndoManager::CommandType> m_undoCommandTypes;

View file

@ -22,6 +22,7 @@
#include "dolphinmainwindow.h"
#include "dolphinstatusbar.h"
#include "dolphinview.h"
#include "dolphinviewcontainer.h"
#include <kactioncollection.h>
#include <kio/job.h>
@ -39,7 +40,7 @@ DolphinNewMenu::~DolphinNewMenu()
void DolphinNewMenu::slotResult(KJob* job)
{
if (job->error()) {
DolphinStatusBar* statusBar = m_mainWin->activeView()->statusBar();
DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
} else {
KNewMenu::slotResult(job);

View file

@ -30,7 +30,7 @@
#include <kiconloader.h>
#include <kvbox.h>
DolphinStatusBar::DolphinStatusBar(DolphinView* parent) :
DolphinStatusBar::DolphinStatusBar(QWidget* parent, const KUrl& url) :
KHBox(parent),
m_messageLabel(0),
m_spaceInfo(0),
@ -43,7 +43,7 @@ DolphinStatusBar::DolphinStatusBar(DolphinView* parent) :
m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_spaceInfo = new StatusBarSpaceInfo(this);
m_spaceInfo->setUrl(parent->url());
m_spaceInfo->setUrl(url);
m_progressText = new QLabel(this);
m_progressText->hide();

View file

@ -53,7 +53,9 @@ public:
Error
};
DolphinStatusBar(DolphinView* parent = 0);
DolphinStatusBar(QWidget* parent,
const KUrl& url);
virtual ~DolphinStatusBar();
/**

File diff suppressed because it is too large Load diff

View file

@ -19,50 +19,46 @@
***************************************************************************/
#ifndef _DOLPHINVIEW_H_
#define _DOLPHINVIEW_H_
#ifndef DOLPHINVIEW_H
#define DOLPHINVIEW_H
#include <kparts/part.h>
#include <kfileitem.h>
#include <kfileitemdelegate.h>
#include <kio/job.h>
#include <kurlnavigator.h>
#include <QtGui/QKeyEvent>
#include <QtCore/QLinkedList>
#include <QtGui/QListView>
#include <QtGui/QBoxLayout>
#include <QtGui/QWidget>
#include <QBoxLayout>
#include <QKeyEvent>
#include <QLinkedList>
#include <QListView>
#include <QWidget>
class DolphinController;
class FilterBar;
class KDirLister;
class KFileItemDelegate;
class KUrl;
class KDirModel;
class KUrlNavigator;
class DolphinColumnView;
class DolphinDetailsView;
class DolphinDirLister;
class DolphinIconsView;
class DolphinMainWindow;
class DolphinSortFilterProxyModel;
class DolphinStatusBar;
class QModelIndex;
class ViewProperties;
/**
* @short Represents a view for the directory content
* including the navigation bar, filter bar and status bar.
* @short Represents a view for the directory content.
*
* View modes for icons, details and columns are supported. Currently
* Dolphin allows to have up to two views inside the main window.
* View modes for icons, details and columns are supported. It's
* possible to adjust:
* - sort order
* - sort type
* - show hidden files
* - show previews
*
* @see DolphinIconsView
* @see DolphinDetailsView
* @see DolphinColumnView
* @see KUrlNavigator
* @see DolphinStatusBar
*/
class DolphinView : public QWidget
{
@ -109,23 +105,29 @@ public:
MaxSortEnum = SortByType
};
DolphinView(DolphinMainWindow* mainwindow,
QWidget *parent,
/**
* @param parent Parent widget of the view.
* @param url Specifies the content which should be shown.
* @param dirLister Used directory lister. The lister is not owned
* by the view and won't get deleted.
* @param dirModel Used directory model. The model is not owned
* by the view and won't get deleted.
* @param proxyModel Used proxy model which specifies the sorting. The
* model is not owned by the view and won't get
* deleted.
* @param mode Used display mode (IconsView, DetailsView or ColumnsView).
* @param showHiddenFiles If true, hidden files will be shown in the view.
*/
DolphinView(QWidget* parent,
const KUrl& url,
KDirLister* dirLister,
KDirModel* dirModel,
DolphinSortFilterProxyModel* proxyModel,
Mode mode = IconsView,
bool showHiddenFiles = false);
virtual ~DolphinView();
/**
* Sets the current active URL, where all actions are applied. The
* URL navigator is synchronized with this URL. The signals
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are emitted.
* @see DolphinView::urlNavigator()
*/
void setUrl(const KUrl& url);
/**
* Returns the current active URL, where all actions are applied.
* The URL navigator is synchronized with this URL.
@ -144,9 +146,10 @@ public:
KUrl rootUrl() const;
/**
* Returns true if the view is active and hence all actions are
* applied to this view.
* If \a active is true, the view will marked as active. The active
* view is defined as view where all actions are applied to.
*/
void setActive(bool active);
bool isActive() const;
/**
@ -215,40 +218,6 @@ public:
*/
void invertSelection();
/**
* Goes back one step in the URL history. The signals
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goBack();
/**
* Goes forward one step in the Url history. The signals
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goForward();
/**
* Goes up one step of the Url path. The signals
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are submitted.
*/
void goUp();
/**
* Goes to the home URL. The signals KUrlNavigator::urlChanged()
* and KUrlNavigator::historyChanged() are submitted.
*/
void goHome();
/**
* Sets the URL of the navigation bar to an editable state
* if \a editable is true. If \a editable is false, each part of
* the location is presented by a button for a fast navigation.
*/
void setUrlEditable(bool editable);
/** Returns true, if at least one item is selected. */
bool hasSelection() const;
@ -280,8 +249,6 @@ public:
*/
void rename(const KUrl& source, const QString& newName);
DolphinStatusBar* statusBar() const;
/**
* Returns the x-position of the view content.
* The content of the view might be larger than the visible area
@ -296,12 +263,6 @@ public:
*/
int contentsY() const;
/**
* Returns true, if the URL shown by the navigation bar is editable.
* @see KUrlNavigator
*/
bool isUrlEditable() const;
/** Increases the size of the current set view mode. */
void zoomIn();
@ -338,21 +299,6 @@ public:
/** Returns the additional information which should be shown for the items. */
KFileItemDelegate::AdditionalInformation additionalInfo() const;
/** Returns the KUrlNavigator of the view for read access. */
const KUrlNavigator* urlNavigator() const
{
return m_urlNavigator;
}
/** Returns true, if the filter bar is visible. */
bool isFilterBarVisible() const;
/**
* Return the DolphinMainWindow this View belongs to. It is guranteed
* that we have one.
*/
DolphinMainWindow* mainWindow() const ;
/** Reloads the current directory. */
void reload();
@ -365,22 +311,10 @@ public:
public slots:
/**
* Popups the filter bar above the status bar if \a show is true.
* Changes the directory to \a url. If the current directory is equal to
* \a url, nothing will be done (use DolphinView::reload() instead).
*/
void showFilterBar(bool show);
/**
* Updates the number of items (= number of files + number of
* directories) in the statusbar. If files are selected, the number
* of selected files and the sum of the filesize is shown.
*/
void updateStatusBar();
/**
* Requests the main window to set this view as active view, which
* means that all actions are applied to this view.
*/
void requestActivation();
void setUrl(const KUrl& url);
/**
* Request of a selection change. The view will do its best to accommodate
@ -391,6 +325,11 @@ public slots:
void changeSelection(const KFileItemList& selection);
signals:
/**
* Is emitted if the view has been activated by e. g. a mouse click.
*/
void activated();
/** Is emitted if URL of the view has been changed to \a url. */
void urlChanged(const KUrl& url);
@ -437,20 +376,38 @@ signals:
*/
void showFilterBarChanged(bool shown);
/**
* Is emitted if a context menu is requested for the item \a item,
* which is part of \a url. If the item is 0, the context menu
* for the URL should be shown.
*/
void requestContextMenu(KFileItem* item, const KUrl& url);
/**
* Is emitted if the URLs \a are dropped to the destination URL
* \a destination. No operation is done within the DolphinView, the
* receiver of the signal has to take care about the corresponding
* operation.
*/
void urlsDropped(const KUrl::List& urls, const KUrl& destination);
protected:
/** @see QWidget::mouseReleaseEvent */
virtual void mouseReleaseEvent(QMouseEvent* event);
private slots:
void changeDirectory(const KUrl& url);
void triggerItem(const QModelIndex& index);
void updateProgress(int percent);
/**
* Marks the view as active (DolphinView:isActive() will return true)
* and emits the 'activated' signal if it is not already active.
*/
void activate();
/**
* Updates the number of items (= number of directories + number of files)
* and shows this information in the statusbar.
* If the item specified by \a index is a directory, then this
* directory will be loaded. If the item is a file, the corresponding
* application will get started.
*/
void updateItemCount();
void triggerItem(const QModelIndex& index);
/**
* Generates a preview image for each file item in \a items.
@ -471,20 +428,7 @@ private slots:
*/
void restoreContentsPos();
/** Shows the information \a msg inside the statusbar. */
void showInfoMessage(const QString& msg);
/** Shows the error message \a msg inside the statusbar. */
void showErrorMessage(const QString& msg);
void emitSelectionChangedSignal();
void closeFilterBar();
/**
* Filters the currently shown items by \a nameFilter. All items
* which contain the given filter string will be shown.
*/
void changeNameFilter(const QString& nameFilter);
/**
* Opens the context menu on position \a pos. The position
@ -525,12 +469,6 @@ private slots:
*/
void emitContentsMoved();
/**
* Updates the activation state of the view by checking whether
* the currently active view is this view.
*/
void updateActivationState();
/** Applies an item effect to all cut items of the clipboard. */
void updateCutItems();
@ -551,18 +489,6 @@ private slots:
private:
void startDirLister(const KUrl& url, bool reload = false);
/**
* Returns the default text of the status bar, if no item is
* selected.
*/
QString defaultStatusBarText() const;
/**
* Returns the text for the status bar, if at least one item
* is selected.
*/
QString selectionStatusBarText() const;
/**
* Creates a new view representing the given view mode (DolphinView::mode()).
* The current view will get deleted.
@ -617,18 +543,13 @@ private:
QPixmap pixmap;
};
bool m_showProgress;
bool m_active;
bool m_blockContentsMovedSignal;
bool m_initializeColumnView;
Mode m_mode;
int m_iconSize;
int m_folderCount;
int m_fileCount;
DolphinMainWindow* m_mainWindow;
QVBoxLayout* m_topLayout;
KUrlNavigator* m_urlNavigator;
DolphinController* m_controller;
DolphinIconsView* m_iconsView;
@ -636,14 +557,11 @@ private:
DolphinColumnView* m_columnView;
KFileItemDelegate* m_fileItemDelegate;
FilterBar* m_filterBar;
DolphinStatusBar* m_statusBar;
KDirModel* m_dirModel;
DolphinDirLister* m_dirLister;
KDirLister* m_dirLister;
DolphinSortFilterProxyModel* m_proxyModel;
QList<CutItem> m_cutItemsCache;
};
#endif // _DOLPHINVIEW_H_
#endif // DOLPHINVIEW_H

View file

@ -0,0 +1,503 @@
/***************************************************************************
* Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
* *
* 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 "dolphinviewcontainer.h"
#include <QtGui/QApplication>
#include <QtGui/QClipboard>
#include <QtGui/QKeyEvent>
#include <QtGui/QItemSelection>
#include <QtGui/QBoxLayout>
#include <QtCore/QTimer>
#include <QtGui/QScrollBar>
#include <kdirmodel.h>
#include <kfileitemdelegate.h>
#include <kfileplacesmodel.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <kiconeffect.h>
#include <kio/netaccess.h>
#include <kio/renamedialog.h>
#include <kio/previewjob.h>
#include <kmimetyperesolver.h>
#include <konqmimedata.h>
#include <konq_operations.h>
#include <kurl.h>
#include "dolphincolumnview.h"
#include "dolphincontroller.h"
#include "dolphinstatusbar.h"
#include "dolphinmainwindow.h"
#include "dolphindirlister.h"
#include "dolphinsortfilterproxymodel.h"
#include "dolphindetailsview.h"
#include "dolphiniconsview.h"
#include "dolphincontextmenu.h"
#include "dolphinitemcategorizer.h"
#include "filterbar.h"
#include "renamedialog.h"
#include "kurlnavigator.h"
#include "viewproperties.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
QWidget* parent,
const KUrl& url,
DolphinView::Mode mode,
bool showHiddenFiles) :
QWidget(parent),
m_showProgress(false),
m_folderCount(0),
m_fileCount(0),
m_mainWindow(mainWindow),
m_topLayout(0),
m_urlNavigator(0),
m_view(0),
m_filterBar(0),
m_statusBar(0),
m_dirModel(0),
m_dirLister(0),
m_proxyModel(0)
{
hide();
setFocusPolicy(Qt::StrongFocus);
m_topLayout = new QVBoxLayout(this);
m_topLayout->setSpacing(0);
m_topLayout->setMargin(0);
connect(m_mainWindow, SIGNAL(activeViewChanged()),
this, SLOT(updateActivationState()));
QClipboard* clipboard = QApplication::clipboard();
connect(clipboard, SIGNAL(dataChanged()),
this, SLOT(updateCutItems()));
m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this);
const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_urlNavigator->setUrlEditable(settings->editableUrl());
m_urlNavigator->setHomeUrl(settings->homeUrl());
m_dirLister = new DolphinDirLister();
m_dirLister->setAutoUpdate(true);
m_dirLister->setMainWindow(this);
m_dirLister->setShowingDotFiles(showHiddenFiles);
m_dirLister->setDelayedMimeTypes(true);
m_dirModel = new KDirModel();
m_dirModel->setDirLister(m_dirLister);
m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory);
m_proxyModel = new DolphinSortFilterProxyModel(this);
m_proxyModel->setSourceModel(m_dirModel);
connect(m_dirLister, SIGNAL(clear()),
this, SLOT(updateStatusBar()));
connect(m_dirLister, SIGNAL(percent(int)),
this, SLOT(updateProgress(int)));
connect(m_dirLister, SIGNAL(deleteItem(KFileItem*)),
this, SLOT(updateStatusBar()));
connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateItemCount()));
connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateCutItems()));
connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
this, SLOT(generatePreviews(const KFileItemList&)));
connect(m_dirLister, SIGNAL(infoMessage(const QString&)),
this, SLOT(showInfoMessage(const QString&)));
connect(m_dirLister, SIGNAL(errorMessage(const QString&)),
this, SLOT(showErrorMessage(const QString&)));
m_view = new DolphinView(this,
url,
m_dirLister,
m_dirModel,
m_proxyModel,
mode,
showHiddenFiles);
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem*, const KUrl&)),
this, SLOT(openContextMenu(KFileItem*, const KUrl&)));
connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
m_view, SLOT(setUrl(const KUrl&)));
m_statusBar = new DolphinStatusBar(this, url);
m_filterBar = new FilterBar(this);
m_filterBar->setVisible(settings->filterBar());
connect(m_filterBar, SIGNAL(filterChanged(const QString&)),
this, SLOT(changeNameFilter(const QString&)));
connect(m_filterBar, SIGNAL(closeRequest()),
this, SLOT(closeFilterBar()));
m_topLayout->addWidget(m_urlNavigator);
m_topLayout->addWidget(m_view);
m_topLayout->addWidget(m_filterBar);
m_topLayout->addWidget(m_statusBar);
}
DolphinViewContainer::~DolphinViewContainer()
{
delete m_dirLister;
m_dirLister = 0;
}
void DolphinViewContainer::setUrl(const KUrl& url)
{
m_urlNavigator->setUrl(url);
}
const KUrl& DolphinViewContainer::url() const
{
return m_urlNavigator->url();
}
void DolphinViewContainer::setActive(bool active)
{
m_urlNavigator->setActive(active);
m_view->setActive(active);
}
bool DolphinViewContainer::isActive() const
{
Q_ASSERT(m_view->isActive() == m_urlNavigator->isActive());
return m_view->isActive();
}
void DolphinViewContainer::renameSelectedItems()
{
DolphinViewContainer* view = m_mainWindow->activeViewContainer();
const KUrl::List urls = m_view->selectedUrls();
if (urls.count() > 1) {
// More than one item has been selected for renaming. Open
// a rename dialog and rename all items afterwards.
RenameDialog dialog(urls);
if (dialog.exec() == QDialog::Rejected) {
return;
}
const QString& newName = dialog.newName();
if (newName.isEmpty()) {
view->statusBar()->setMessage(dialog.errorString(),
DolphinStatusBar::Error);
} else {
// TODO: check how this can be integrated into KonqUndoManager/KonqOperations
// as one operation instead of n rename operations like it is done now...
Q_ASSERT(newName.contains('#'));
// iterate through all selected items and rename them...
const int replaceIndex = newName.indexOf('#');
Q_ASSERT(replaceIndex >= 0);
int index = 1;
KUrl::List::const_iterator it = urls.begin();
KUrl::List::const_iterator end = urls.end();
while (it != end) {
const KUrl& oldUrl = *it;
QString number;
number.setNum(index++);
QString name(newName);
name.replace(replaceIndex, 1, number);
if (oldUrl.fileName() != name) {
KUrl newUrl = oldUrl;
newUrl.setFileName(name);
m_mainWindow->rename(oldUrl, newUrl);
}
++it;
}
}
} else {
// Only one item has been selected for renaming. Use the custom
// renaming mechanism from the views.
Q_ASSERT(urls.count() == 1);
// TODO: Think about using KFileItemDelegate as soon as it supports editing.
// Currently the RenameDialog is used, but I'm not sure whether inline renaming
// is a benefit for the user at all -> let's wait for some input first...
RenameDialog dialog(urls);
if (dialog.exec() == QDialog::Rejected) {
return;
}
const QString& newName = dialog.newName();
if (newName.isEmpty()) {
view->statusBar()->setMessage(dialog.errorString(),
DolphinStatusBar::Error);
} else {
const KUrl& oldUrl = urls.first();
KUrl newUrl = oldUrl;
newUrl.setFileName(newName);
m_mainWindow->rename(oldUrl, newUrl);
}
}
}
DolphinStatusBar* DolphinViewContainer::statusBar() const
{
return m_statusBar;
}
bool DolphinViewContainer::isFilterBarVisible() const
{
return m_filterBar->isVisible();
}
bool DolphinViewContainer::isUrlEditable() const
{
return m_urlNavigator->isUrlEditable();
}
KFileItem* DolphinViewContainer::fileItem(const QModelIndex index) const
{
const QModelIndex dirModelIndex = m_proxyModel->mapToSource(index);
return m_dirModel->itemForIndex(dirModelIndex);
}
void DolphinViewContainer::rename(const KUrl& source, const QString& newName)
{
bool ok = false;
if (newName.isEmpty() || (source.fileName() == newName)) {
return;
}
KUrl dest(source.upUrl());
dest.addPath(newName);
const bool destExists = KIO::NetAccess::exists(dest, false, this);
if (destExists) {
// the destination already exists, hence ask the user
// how to proceed...
KIO::RenameDialog renameDialog(this,
i18n("File Already Exists"),
source.path(),
dest.path(),
KIO::M_OVERWRITE);
switch (renameDialog.exec()) {
case KIO::R_OVERWRITE:
// the destination should be overwritten
ok = KIO::NetAccess::file_move(source, dest, -1, true);
break;
case KIO::R_RENAME: {
// a new name for the destination has been used
KUrl newDest(renameDialog.newDestUrl());
ok = KIO::NetAccess::file_move(source, newDest);
break;
}
default:
// the renaming operation has been canceled
return;
}
} else {
// no destination exists, hence just move the file to
// do the renaming
ok = KIO::NetAccess::file_move(source, dest);
}
const QString destFileName = dest.fileName();
if (ok) {
m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName),
DolphinStatusBar::OperationCompleted);
KonqOperations::rename(this, source, destFileName);
} else {
m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
DolphinStatusBar::Error);
}
}
DolphinMainWindow* DolphinViewContainer::mainWindow() const
{
return m_mainWindow;
}
void DolphinViewContainer::updateProgress(int percent)
{
if (m_showProgress) {
m_statusBar->setProgress(percent);
}
}
void DolphinViewContainer::updateItemCount()
{
if (m_showProgress) {
m_statusBar->setProgressText(QString());
m_statusBar->setProgress(100);
m_showProgress = false;
}
KFileItemList items(m_dirLister->items());
KFileItemList::const_iterator it = items.begin();
const KFileItemList::const_iterator end = items.end();
m_fileCount = 0;
m_folderCount = 0;
while (it != end) {
KFileItem* item = *it;
if (item->isDir()) {
++m_folderCount;
} else {
++m_fileCount;
}
++it;
}
updateStatusBar();
QTimer::singleShot(0, this, SLOT(restoreContentsPos()));
}
void DolphinViewContainer::showInfoMessage(const QString& msg)
{
m_statusBar->setMessage(msg, DolphinStatusBar::Information);
}
void DolphinViewContainer::showErrorMessage(const QString& msg)
{
m_statusBar->setMessage(msg, DolphinStatusBar::Error);
}
void DolphinViewContainer::closeFilterBar()
{
m_filterBar->hide();
emit showFilterBarChanged(false);
}
QString DolphinViewContainer::defaultStatusBarText() const
{
return KIO::itemsSummaryString(m_fileCount + m_folderCount,
m_fileCount,
m_folderCount,
0, false);
}
QString DolphinViewContainer::selectionStatusBarText() const
{
QString text;
const KFileItemList list = m_view->selectedItems();
if (list.isEmpty()) {
// when an item is triggered, it is temporary selected but selectedItems()
// will return an empty list
return QString();
}
int fileCount = 0;
int folderCount = 0;
KIO::filesize_t byteSize = 0;
KFileItemList::const_iterator it = list.begin();
const KFileItemList::const_iterator end = list.end();
while (it != end) {
KFileItem* item = *it;
if (item->isDir()) {
++folderCount;
} else {
++fileCount;
byteSize += item->size();
}
++it;
}
if (folderCount > 0) {
text = i18np("1 Folder selected", "%1 Folders selected", folderCount);
if (fileCount > 0) {
text += ", ";
}
}
if (fileCount > 0) {
const QString sizeText(KIO::convertSize(byteSize));
text += i18np("1 File selected (%2)", "%1 Files selected (%2)", fileCount, sizeText);
}
return text;
}
void DolphinViewContainer::showFilterBar(bool show)
{
Q_ASSERT(m_filterBar != 0);
m_filterBar->setVisible(show);
}
void DolphinViewContainer::updateStatusBar()
{
// As the item count information is less important
// in comparison with other messages, it should only
// be shown if:
// - the status bar is empty or
// - shows already the item count information or
// - shows only a not very important information
// - if any progress is given don't show the item count info at all
const QString msg(m_statusBar->message());
const bool updateStatusBarMsg = (msg.isEmpty() ||
(msg == m_statusBar->defaultText()) ||
(m_statusBar->type() == DolphinStatusBar::Information)) &&
(m_statusBar->progress() == 100);
const QString text(m_view->hasSelection() ? selectionStatusBarText() : defaultStatusBarText());
m_statusBar->setDefaultText(text);
if (updateStatusBarMsg) {
m_statusBar->setMessage(text, DolphinStatusBar::Default);
}
}
void DolphinViewContainer::changeNameFilter(const QString& nameFilter)
{
// The name filter of KDirLister does a 'hard' filtering, which
// means that only the items are shown where the names match
// exactly the filter. This is non-transparent for the user, which
// just wants to have a 'soft' filtering: does the name contain
// the filter string?
QString adjustedFilter(nameFilter);
adjustedFilter.insert(0, '*');
adjustedFilter.append('*');
// Use the ProxyModel to filter:
// This code is #ifdefed as setNameFilter behaves
// slightly different than the QSortFilterProxyModel
// as it will not remove directories. I will ask
// our beloved usability experts for input
// -- z.
#if 0
m_dirLister->setNameFilter(adjustedFilter);
m_dirLister->emitChanges();
#else
m_proxyModel->setFilterRegExp(nameFilter);
#endif
}
void DolphinViewContainer::openContextMenu(KFileItem* item,
const KUrl& url)
{
DolphinContextMenu contextMenu(m_mainWindow, item, url);
contextMenu.open();
}
#include "dolphinviewcontainer.moc"

232
src/dolphinviewcontainer.h Normal file
View file

@ -0,0 +1,232 @@
/***************************************************************************
* Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
* *
* 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 *
***************************************************************************/
#ifndef DOLPHINVIEWCONTAINER_H
#define DOLPHINVIEWCONTAINER_H
#include "dolphinview.h"
#include <kparts/part.h>
#include <kfileitem.h>
#include <kfileitemdelegate.h>
#include <kio/job.h>
#include <kurlnavigator.h>
#include <QtGui/QKeyEvent>
#include <QtCore/QLinkedList>
#include <QtGui/QListView>
#include <QtGui/QBoxLayout>
#include <QtGui/QWidget>
class DolphinController;
class FilterBar;
class KFileItemDelegate;
class KUrl;
class KDirModel;
class KUrlNavigator;
class DolphinColumnView;
class DolphinDetailsView;
class DolphinDirLister;
class DolphinIconsView;
class DolphinMainWindow;
class DolphinSortFilterProxyModel;
class DolphinStatusBar;
class QModelIndex;
class ViewProperties;
/**
* @short Represents a view for the directory content
* including the navigation bar, filter bar and status bar.
*
* View modes for icons, details and columns are supported. Currently
* Dolphin allows to have up to two views inside the main window.
*
* @see DolphinView
* @see FilterBar
* @see KUrlNavigator
* @see DolphinStatusBar
*/
class DolphinViewContainer : public QWidget
{
Q_OBJECT
public:
DolphinViewContainer(DolphinMainWindow* mainwindow,
QWidget *parent,
const KUrl& url,
DolphinView::Mode mode = DolphinView::IconsView,
bool showHiddenFiles = false);
virtual ~DolphinViewContainer();
/**
* Sets the current active URL, where all actions are applied. The
* URL navigator is synchronized with this URL. The signals
* KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
* are emitted.
* @see DolphinViewContainer::urlNavigator()
*/
void setUrl(const KUrl& url);
/**
* Returns the current active URL, where all actions are applied.
* The URL navigator is synchronized with this URL.
*/
const KUrl& url() const;
/**
* If \a active is true, the view container will marked as active. The active
* view container is defined as view where all actions are applied to.
*/
void setActive(bool active);
bool isActive() const;
/**
* Triggers the renaming of the currently selected items, where
* the user must input a new name for the items.
*/
void renameSelectedItems();
KFileItem* fileItem(const QModelIndex index) const;
/**
* Renames the filename of the source URL by the new file name.
* If the new file name already exists, a dialog is opened which
* asks the user to enter a new name.
*/
void rename(const KUrl& source, const QString& newName);
DolphinStatusBar* statusBar() const;
/**
* Returns true, if the URL shown by the navigation bar is editable.
* @see KUrlNavigator
*/
bool isUrlEditable() const;
inline KUrlNavigator* urlNavigator() const;
inline DolphinView* view() const;
/** Returns true, if the filter bar is visible. */
bool isFilterBarVisible() const;
/**
* Return the DolphinMainWindow this View belongs to. It is guaranteed
* that we have one.
*/
DolphinMainWindow* mainWindow() const ;
public slots:
/**
* Popups the filter bar above the status bar if \a show is true.
*/
void showFilterBar(bool show);
/**
* Updates the number of items (= number of files + number of
* directories) in the statusbar. If files are selected, the number
* of selected files and the sum of the filesize is shown.
*/
void updateStatusBar();
signals:
/**
* Is emitted whenever the filter bar has changed its visibility state.
*/
void showFilterBarChanged(bool shown);
private slots:
void updateProgress(int percent);
/**
* Updates the number of items (= number of directories + number of files)
* and shows this information in the statusbar.
*/
void updateItemCount();
/** Shows the information \a msg inside the statusbar. */
void showInfoMessage(const QString& msg);
/** Shows the error message \a msg inside the statusbar. */
void showErrorMessage(const QString& msg);
void closeFilterBar();
/**
* Filters the currently shown items by \a nameFilter. All items
* which contain the given filter string will be shown.
*/
void changeNameFilter(const QString& nameFilter);
/**
* Opens the context menu on the current mouse postition.
* @item File item context. If item is 0, the context menu
* should be applied to \a url.
* @url URL which contains \a item.
*/
void openContextMenu(KFileItem* item, const KUrl& url);
private:
/**
* Returns the default text of the status bar, if no item is
* selected.
*/
QString defaultStatusBarText() const;
/**
* Returns the text for the status bar, if at least one item
* is selected.
*/
QString selectionStatusBarText() const;
private:
bool m_showProgress;
int m_iconSize;
int m_folderCount;
int m_fileCount;
DolphinMainWindow* m_mainWindow;
QVBoxLayout* m_topLayout;
KUrlNavigator* m_urlNavigator;
DolphinView* m_view;
FilterBar* m_filterBar;
DolphinStatusBar* m_statusBar;
KDirModel* m_dirModel;
DolphinDirLister* m_dirLister;
DolphinSortFilterProxyModel* m_proxyModel;
};
KUrlNavigator* DolphinViewContainer::urlNavigator() const
{
return m_urlNavigator;
}
DolphinView* DolphinViewContainer::view() const
{
return m_view;
}
#endif // DOLPHINVIEWCONTAINER_H

View file

@ -20,23 +20,24 @@
#include "generalsettingspage.h"
#include "dolphinsettings.h"
#include "dolphinmainwindow.h"
#include "dolphinview.h"
#include "dolphinviewcontainer.h"
#include "dolphin_generalsettings.h"
#include <kdialog.h>
#include <kfiledialog.h>
#include <klocale.h>
#include <kvbox.h>
#include <QtGui/QCheckBox>
#include <QtGui/QGroupBox>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include "dolphinsettings.h"
#include "dolphinmainwindow.h"
#include "dolphinview.h"
#include "dolphin_generalsettings.h"
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) :
SettingsPageBase(parent),
@ -180,7 +181,7 @@ void GeneralSettingsPage::selectHomeUrl()
void GeneralSettingsPage::useCurrentLocation()
{
const DolphinView* view = m_mainWindow->activeView();
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
m_homeUrl->setText(view->url().prettyUrl());
}

View file

@ -20,15 +20,17 @@
#include "generalviewsettingspage.h"
#include "dolphinmainwindow.h"
#include "dolphinsettings.h"
#include "dolphin_generalsettings.h"
#include "dolphinviewcontainer.h"
#include "viewproperties.h"
#include <QtGui/QLabel>
#include <QtGui/QGroupBox>
#include <QtGui/QRadioButton>
#include <QtGui/QSlider>
#include <QtGui/QSpinBox>
#include <QtGui/QBoxLayout>
#include "dolphin_generalsettings.h"
#include <QLabel>
#include <QGroupBox>
#include <QRadioButton>
#include <QSlider>
#include <QSpinBox>
#include <QBoxLayout>
#include <kconfiggroup.h>
#include <kdialog.h>
@ -100,7 +102,7 @@ GeneralViewSettingsPage::~GeneralViewSettingsPage()
void GeneralViewSettingsPage::applySettings()
{
const KUrl& url = m_mainWindow->activeView()->url();
const KUrl& url = m_mainWindow->activeViewContainer()->url();
ViewProperties props(url); // read current view properties
const bool useGlobalProps = m_globalProps->isChecked();