#include <QClipboard>
#include <QDir>
+Qt::MouseButtons DolphinController::m_mouseButtons = Qt::NoButton;
+
DolphinController::DolphinController(DolphinView* dolphinView) :
QObject(dolphinView),
m_zoomLevel(0),
- m_mouseButtons(Qt::NoButton),
+ m_nameFilter(),
m_url(),
m_dolphinView(dolphinView),
- m_itemView(0)
+ m_itemView(0),
+ m_versionControlActions()
{
}
{
if (m_url != url) {
m_url = url;
+ emit cancelPreviews();
emit urlChanged(url);
}
}
+void DolphinController::redirectToUrl(const KUrl& url)
+{
+ m_url = url;
+}
+
void DolphinController::setItemView(QAbstractItemView* view)
{
if (m_itemView != 0) {
}
}
-void DolphinController::triggerContextMenuRequest(const QPoint& pos)
+void DolphinController::triggerContextMenuRequest(const QPoint& pos,
+ const QList<QAction*>& customActions)
{
emit activated();
- emit requestContextMenu(pos);
+ emit requestContextMenu(pos, customActions);
}
void DolphinController::requestActivation()
emit sortOrderChanged(order);
}
+void DolphinController::indicateSortFoldersFirstChange(bool foldersFirst)
+{
+ emit sortFoldersFirstChanged(foldersFirst);
+}
+
void DolphinController::indicateAdditionalInfoChange(const KFileItemDelegate::InformationList& info)
{
emit additionalInfoChanged(info);
emit activationChanged(active);
}
+void DolphinController::setNameFilter(const QString& nameFilter)
+{
+ if (nameFilter != m_nameFilter) {
+ m_nameFilter = nameFilter;
+ emit nameFilterChanged(nameFilter);
+ }
+}
+
+QString DolphinController::nameFilter() const
+{
+ return m_nameFilter;
+}
+
void DolphinController::setZoomLevel(int level)
{
Q_ASSERT(level >= ZoomLevelInfo::minimumLevel());
}
}
+void DolphinController::setVersionControlActions(QList<QAction*> actions)
+{
+ m_versionControlActions = actions;
+}
+
+QList<QAction*> DolphinController::versionControlActions(const KFileItemList& items)
+{
+ emit requestVersionControlActions(items);
+ // All view implementations are connected with the signal requestVersionControlActions()
+ // (see ViewExtensionFactory) and will invoke DolphinController::setVersionControlActions(),
+ // so that the context dependent actions can be returned.
+ return m_versionControlActions;
+}
+
void DolphinController::handleKeyPressEvent(QKeyEvent* event)
{
Q_ASSERT(m_itemView != 0);
const bool trigger = currentIndex.isValid()
&& ((event->key() == Qt::Key_Return)
|| (event->key() == Qt::Key_Enter))
- && (selModel->selectedIndexes().count() > 0);
+ && !selModel->selectedIndexes().isEmpty();
if (trigger) {
const QModelIndexList indexList = selModel->selectedIndexes();
foreach (const QModelIndex& index, indexList) {
emit hideToolTip();
}
+void DolphinController::emitItemTriggered(const KFileItem& item)
+{
+ emit itemTriggered(item);
+}
+
KFileItem DolphinController::itemForIndex(const QModelIndex& index) const
{
Q_ASSERT(m_itemView != 0);
m_itemView->clearSelection();
emit itemEntered(KFileItem());
}
- m_mouseButtons = Qt::NoButton;
- } else if (m_mouseButtons & Qt::RightButton) {
- m_mouseButtons = Qt::NoButton;
}
}
if (validRequest) {
emit tabRequested(item.url());
}
- m_mouseButtons = Qt::NoButton;
- } else if (m_mouseButtons & Qt::RightButton) {
- m_mouseButtons = Qt::NoButton;
}
}
emit viewportEntered();
}
+void DolphinController::emitSelectionChanged()
+{
+ emit selectionChanged();
+}
+
void DolphinController::updateMouseButtonState()
{
m_mouseButtons = QApplication::mouseButtons();