]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
replace QList<KFileItem> by KFileItemList, as KFileItemList is not QList<KFileItem...
[dolphin.git] / src / dolphinmainwindow.cpp
index cffe6add93dee13de3476c4979be698a6a6ebd83..38408d7bf341b31441f09b3d42204cf4a2e304c5 100644 (file)
@@ -150,6 +150,9 @@ void DolphinMainWindow::refreshViews()
 void DolphinMainWindow::dropUrls(const KUrl::List& urls,
                                  const KUrl& destination)
 {
+    kDebug() << "Source" << urls;
+    kDebug() << "Destination:" << destination;
+
     Qt::DropAction action = Qt::CopyAction;
 
     Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
@@ -237,7 +240,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
     }
 }
 
-void DolphinMainWindow::changeSelection(const QList<KFileItem>& selection)
+void DolphinMainWindow::changeSelection(const KFileItemList& selection)
 {
     activeViewContainer()->view()->changeSelection(selection);
 }
@@ -321,9 +324,11 @@ void DolphinMainWindow::slotSortOrderChanged(Qt::SortOrder order)
     descending->setChecked(sortDescending);
 }
 
-void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation info)
+void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::InformationList list)
 {
     QAction* action = 0;
+    KFileItemDelegate::Information info = list.isEmpty() ? KFileItemDelegate::NoInformation : list.first();
+
     switch (info) {
     case KFileItemDelegate::FriendlyMimeType:
         action = actionCollection()->action("show_mime_info");
@@ -351,7 +356,7 @@ void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::AdditionalI
     }
 }
 
-void DolphinMainWindow::slotSelectionChanged(const QList<KFileItem>& selection)
+void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
 {
     updateEditActions();
 
@@ -490,14 +495,9 @@ void DolphinMainWindow::deleteItems()
 
 void DolphinMainWindow::properties()
 {
-    QList<KFileItem> list = m_activeViewContainer->view()->selectedItems();
-    // ### KPropertiesDialog still uses pointer-based KFileItemList
-    KFileItemList lst;
-    // Can't be a const_iterator :(
-    for ( QList<KFileItem>::iterator it = list.begin(), end = list.end() ; it != end ; ++it ) {
-        lst << & *it; // ugly!
-    }
-    KPropertiesDialog dialog(lst, this);
+    const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+
+    KPropertiesDialog dialog(list, this);
     dialog.exec();
 }
 
@@ -1311,7 +1311,11 @@ void DolphinMainWindow::setupActions()
     connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(adjustViewProperties()));
 
     // setup 'Go' menu
-    KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    KShortcut backShortcut = backAction->shortcut();
+    backShortcut.setAlternate(Qt::Key_Backspace);
+    backAction->setShortcut(backShortcut);
+
     KStandardAction::forward(this, SLOT(goForward()), actionCollection());
     KStandardAction::up(this, SLOT(goUp()), actionCollection());
     KStandardAction::home(this, SLOT(goHome()), actionCollection());
@@ -1348,14 +1352,14 @@ void DolphinMainWindow::setupDockWidgets()
     infoDock->setWidget(infoWidget);
 
     infoDock->toggleViewAction()->setText(i18nc("@title:window", "Information"));
-    infoDock->toggleViewAction()->setShortcut(Qt::Key_F8);
+    infoDock->toggleViewAction()->setShortcut(Qt::Key_F11);
     actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
 
     addDockWidget(Qt::RightDockWidgetArea, infoDock);
     connect(this, SIGNAL(urlChanged(KUrl)),
             infoWidget, SLOT(setUrl(KUrl)));
-    connect(this, SIGNAL(selectionChanged(QList<KFileItem>)),
-            infoWidget, SLOT(setSelection(QList<KFileItem>)));
+    connect(this, SIGNAL(selectionChanged(KFileItemList)),
+            infoWidget, SLOT(setSelection(KFileItemList)));
     connect(this, SIGNAL(requestItemInfo(KFileItem)),
             infoWidget, SLOT(requestDelayedItemInfo(KFileItem)));
 
@@ -1367,7 +1371,7 @@ void DolphinMainWindow::setupDockWidgets()
     treeViewDock->setWidget(treeWidget);
 
     treeViewDock->toggleViewAction()->setText(i18nc("@title:window", "Folders"));
-    treeViewDock->toggleViewAction()->setShortcut(Qt::Key_F9);
+    treeViewDock->toggleViewAction()->setShortcut(Qt::Key_F7);
     actionCollection()->addAction("show_folders_panel", treeViewDock->toggleViewAction());
 
     addDockWidget(Qt::LeftDockWidgetArea, treeViewDock);
@@ -1375,8 +1379,8 @@ void DolphinMainWindow::setupDockWidgets()
             treeWidget, SLOT(setUrl(KUrl)));
     connect(treeWidget, SIGNAL(changeUrl(KUrl)),
             this, SLOT(changeUrl(KUrl)));
-    connect(treeWidget, SIGNAL(changeSelection(QList<KFileItem>)),
-            this, SLOT(changeSelection(QList<KFileItem>)));
+    connect(treeWidget, SIGNAL(changeSelection(KFileItemList)),
+            this, SLOT(changeSelection(KFileItemList)));
     connect(treeWidget, SIGNAL(urlsDropped(KUrl::List, KUrl)),
             this, SLOT(dropUrls(KUrl::List, KUrl)));
 
@@ -1410,7 +1414,7 @@ void DolphinMainWindow::setupDockWidgets()
     listView->setModel(DolphinSettings::instance().placesModel());
 
     placesDock->toggleViewAction()->setText(i18nc("@title:window", "Places"));
-    placesDock->toggleViewAction()->setShortcut(Qt::Key_F7);
+    placesDock->toggleViewAction()->setShortcut(Qt::Key_F9);
     actionCollection()->addAction("show_places_panel", placesDock->toggleViewAction());
 
     addDockWidget(Qt::LeftDockWidgetArea, placesDock);
@@ -1438,7 +1442,7 @@ void DolphinMainWindow::updateHistory()
 
 void DolphinMainWindow::updateEditActions()
 {
-    const QList<KFileItem> list = m_activeViewContainer->view()->selectedItems();
+    const KFileItemList list = m_activeViewContainer->view()->selectedItems();
     if (list.isEmpty()) {
         stateChanged("has_no_selection");
     } else {
@@ -1451,8 +1455,8 @@ void DolphinMainWindow::updateEditActions()
 
         bool enableMoveToTrash = true;
 
-        QList<KFileItem>::const_iterator it = list.begin();
-        const QList<KFileItem>::const_iterator end = list.end();
+        KFileItemList::const_iterator it = list.begin();
+        const KFileItemList::const_iterator end = list.end();
         while (it != end) {
             const KUrl& url = (*it).url();
             // only enable the 'Move to Trash' action for local files
@@ -1575,10 +1579,10 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
             this, SLOT(slotSortingChanged(DolphinView::Sorting)));
     connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
             this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
-    connect(view, SIGNAL(additionalInfoChanged(KFileItemDelegate::AdditionalInformation)),
-            this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation)));
-    connect(view, SIGNAL(selectionChanged(QList<KFileItem>)),
-            this, SLOT(slotSelectionChanged(QList<KFileItem>)));
+    connect(view, SIGNAL(additionalInfoChanged(KFileItemDelegate::InformationList)),
+            this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::InformationList)));
+    connect(view, SIGNAL(selectionChanged(KFileItemList)),
+            this, SLOT(slotSelectionChanged(KFileItemList)));
     connect(view, SIGNAL(requestItemInfo(KFileItem)),
             this, SLOT(slotRequestItemInfo(KFileItem)));
     connect(view, SIGNAL(activated()),