#include "viewpropertiesdialog.h"
#include "dolphinview.h"
+#include "zoomlevelinfo.h"
#include <konq_operations.h>
#include <klocale.h>
#include <ktoggleaction.h>
#include <krun.h>
+#include <kpropertiesdialog.h>
DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent)
: QObject(parent),
this, SLOT(slotShowHiddenFilesChanged()));
connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(slotSortingChanged(DolphinView::Sorting)));
+ connect(view, SIGNAL(zoomLevelChanged(int)),
+ this, SLOT(slotZoomLevelChanged(int)));
}
void DolphinViewActionHandler::createActions()
// can be used for deleting the file (#76016). It needs to be a separate action
// so that the Edit menu isn't affected.
KAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut");
- // TODO after message freeze, a more descriptive text, for the shortcuts editor.
- deleteWithTrashShortcut->setText(i18nc("@action:inmenu File", "Delete"));
+ // The descriptive text is just for the shortcuts editor.
+ deleteWithTrashShortcut->setText(i18nc("@action:inmenu File", "Delete (using shortcut for Trash)"));
deleteWithTrashShortcut->setShortcut(QKeySequence::Delete);
deleteWithTrashShortcut->setEnabled(false);
connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+ KAction *propertiesAction = m_actionCollection->addAction( "properties" );
+ // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
+ propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
+ propertiesAction->setShortcut(Qt::ALT | Qt::Key_Return);
+ connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
+
// View menu
QActionGroup* viewModeActions = new QActionGroup(this);
viewModeAction->setChecked(true);
}
- QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
- if (zoomInAction != 0) {
- zoomInAction->setEnabled(m_currentView->isZoomInPossible());
- }
-
- QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
- if (zoomOutAction != 0) {
- zoomOutAction->setEnabled(m_currentView->isZoomOutPossible());
- }
-
QAction* showPreviewAction = m_actionCollection->action("show_preview");
showPreviewAction->setChecked(m_currentView->showPreview());
slotAdditionalInfoChanged();
slotCategorizedSortingChanged();
slotSortingChanged(m_currentView->sorting());
+ slotZoomLevelChanged(m_currentView->zoomLevel());
QAction* showHiddenFilesAction = m_actionCollection->action("show_hidden_files");
showHiddenFilesAction->setChecked(m_currentView->showHiddenFiles());
void DolphinViewActionHandler::zoomIn()
{
- m_currentView->zoomIn();
+ const int level = m_currentView->zoomLevel();
+ m_currentView->setZoomLevel(level + 1);
updateViewActions();
}
void DolphinViewActionHandler::zoomOut()
{
- m_currentView->zoomOut();
+ const int level = m_currentView->zoomLevel();
+ m_currentView->setZoomLevel(level - 1);
updateViewActions();
}
}
}
+void DolphinViewActionHandler::slotZoomLevelChanged(int level)
+{
+ QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
+ if (zoomInAction != 0) {
+ zoomInAction->setEnabled(level < ZoomLevelInfo::maximumLevel());
+ }
+
+ QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
+ if (zoomOutAction != 0) {
+ zoomOutAction->setEnabled(level > ZoomLevelInfo::minimumLevel());
+ }
+}
+
void DolphinViewActionHandler::slotSortTriggered(QAction* action)
{
const DolphinView::Sorting sorting = action->data().value<DolphinView::Sorting>();
{
KRun::run("kfind", m_currentView->url(), m_currentView->window());
}
+
+void DolphinViewActionHandler::slotProperties()
+{
+ KPropertiesDialog* dialog = 0;
+ const KFileItemList list = m_currentView->selectedItems();
+ if (list.isEmpty()) {
+ const KUrl url = m_currentView->url();
+ dialog = new KPropertiesDialog(url, m_currentView);
+ } else {
+ dialog = new KPropertiesDialog(list, m_currentView);
+ }
+
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
+ dialog->raise();
+ dialog->activateWindow();
+}