┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-05-12 10:22:01 +0000
committerPeter Penz <[email protected]>2007-05-12 10:22:01 +0000
commit794911106c265c8691689f601e4aed0862aff0b8 (patch)
treea5f2765fb289ee37d87d6c41601efe4acb993dce /src
parentd03b27f28850e25d087f946e3a5c99b21c76f359 (diff)
provide a hover information in the statusbar if the mouse cursor enters an item
svn path=/trunk/KDE/kdebase/apps/; revision=663779
Diffstat (limited to 'src')
-rw-r--r--src/dolphincolumnview.cpp5
-rw-r--r--src/dolphincontroller.cpp10
-rw-r--r--src/dolphincontroller.h27
-rw-r--r--src/dolphindetailsview.cpp6
-rw-r--r--src/dolphiniconsview.cpp5
-rw-r--r--src/dolphinview.cpp23
-rw-r--r--src/dolphinview.h14
7 files changed, 89 insertions, 1 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index 563f68f31..dbed1304b 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -42,6 +42,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control
setDragDropMode(QAbstractItemView::DragDrop);
setDropIndicatorShown(false);
+ setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
if (KGlobalSettings::singleClick()) {
@@ -53,6 +54,10 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control
}
connect(this, SIGNAL(activated(const QModelIndex&)),
controller, SLOT(triggerItem(const QModelIndex&)));
+ connect(this, SIGNAL(entered(const QModelIndex&)),
+ controller, SLOT(emitItemEntered(const QModelIndex&)));
+ connect(this, SIGNAL(viewportEntered()),
+ controller, SLOT(emitViewportEntered()));
connect(controller, SIGNAL(zoomIn()),
this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp
index 762526b3c..4f8d8c96f 100644
--- a/src/dolphincontroller.cpp
+++ b/src/dolphincontroller.cpp
@@ -92,6 +92,16 @@ void DolphinController::triggerItem(const QModelIndex& index)
emit itemTriggered(index);
}
+void DolphinController::emitItemEntered(const QModelIndex& index)
+{
+ emit itemEntered(index);
+}
+
+void DolphinController::emitViewportEntered()
+{
+ emit viewportEntered();
+}
+
void DolphinController::indicateSelectionChange()
{
emit selectionChanged();
diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h
index b9431f3a7..1f277e133 100644
--- a/src/dolphincontroller.h
+++ b/src/dolphincontroller.h
@@ -84,7 +84,23 @@ public:
inline bool isZoomOutPossible() const;
public slots:
+ /**
+ * Emits the signal itemTriggered(). The method should be invoked by the
+ * controller parent whenever the user has triggered an item. */
void triggerItem(const QModelIndex& index);
+
+ /**
+ * Emits the signal itemEntered(). The method should be invoked by
+ * the controller parent whenever the mouse cursor is above an item.
+ */
+ void emitItemEntered(const QModelIndex& index);
+
+ /**
+ * Emits the signal viewportEntered(). The method should be invoked by
+ * the controller parent whenever the mouse cursor is above the viewport.
+ */
+ void emitViewportEntered();
+
void indicateSelectionChange();
signals:
@@ -136,6 +152,17 @@ signals:
*/
void itemTriggered(const QModelIndex& index);
+ /**
+ * Is emitted if the mouse cursor has entered the item
+ * given by \a index.
+ */
+ void itemEntered(const QModelIndex& index);
+
+ /**
+ * Is emitted if the mouse cursor has entered
+ * the viewport. */
+ void viewportEntered();
+
/** Is emitted if the selection has been changed by the user. */
void selectionChanged();
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 74963dc3d..df07fb9a5 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -46,6 +46,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
setDragDropMode(QAbstractItemView::DragDrop);
setDropIndicatorShown(false);
+ setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
const ViewProperties props(controller->url());
@@ -69,7 +70,10 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
}
connect(this, SIGNAL(activated(const QModelIndex&)),
controller, SLOT(triggerItem(const QModelIndex&)));
-
+ connect(this, SIGNAL(entered(const QModelIndex&)),
+ controller, SLOT(emitItemEntered(const QModelIndex&)));
+ connect(this, SIGNAL(viewportEntered()),
+ controller, SLOT(emitViewportEntered()));
connect(controller, SIGNAL(zoomIn()),
this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index c2262c1bc..25776412b 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -40,6 +40,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
setViewMode(QListView::IconMode);
setResizeMode(QListView::Adjust);
+ setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
if (KGlobalSettings::singleClick()) {
@@ -51,6 +52,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
}
connect(this, SIGNAL(activated(const QModelIndex&)),
controller, SLOT(triggerItem(const QModelIndex&)));
+ connect(this, SIGNAL(entered(const QModelIndex&)),
+ controller, SLOT(emitItemEntered(const QModelIndex&)));
+ connect(this, SIGNAL(viewportEntered()),
+ controller, SLOT(emitViewportEntered()));
connect(controller, SIGNAL(showPreviewChanged(bool)),
this, SLOT(slotShowPreviewChanged(bool)));
connect(controller, SIGNAL(showAdditionalInfoChanged(bool)),
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 4188959f1..8360f037d 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -157,6 +157,10 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow,
this, SLOT(emitSelectionChangedSignal()));
connect(m_controller, SIGNAL(activated()),
this, SLOT(requestActivation()));
+ connect(m_controller, SIGNAL(itemEntered(const QModelIndex&)),
+ this, SLOT(showHoverInformation(const QModelIndex&)));
+ connect(m_controller, SIGNAL(viewportEntered()),
+ this, SLOT(clearHoverInformation()));
createView();
@@ -1179,6 +1183,25 @@ void DolphinView::updateCutItems()
applyCutItemEffect();
}
+void DolphinView::showHoverInformation(const QModelIndex& index)
+{
+ if (hasSelection()) {
+ return;
+ }
+
+ const KFileItem* item = fileItem(index);
+ if (item != 0) {
+ m_statusBar->setMessage(item->getStatusBarInfo(), DolphinStatusBar::Default);
+ emit requestItemInfo(item->url());
+ }
+}
+
+void DolphinView::clearHoverInformation()
+{
+ m_statusBar->clear();
+}
+
+
void DolphinView::createView()
{
// delete current view
diff --git a/src/dolphinview.h b/src/dolphinview.h
index b3b206002..96b487961 100644
--- a/src/dolphinview.h
+++ b/src/dolphinview.h
@@ -528,6 +528,20 @@ private slots:
/** Applies an item effect to all cut items of the clipboard. */
void updateCutItems();
+ /**
+ * Updates the status bar to show hover information for the
+ * item with the index \a index. If currently other items are selected,
+ * no hover information is shown.
+ * @see DolphinView::clearHoverInformation()
+ */
+ void showHoverInformation(const QModelIndex& index);
+
+ /**
+ * Clears the hover information shown in the status bar.
+ * @see DolphinView::showHoverInformation().
+ */
+ void clearHoverInformation();
+
private:
void startDirLister(const KUrl& url, bool reload = false);