]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/treeviewsidebarpage.cpp
preview did not work anymore (KDirLister emits the signal newItems(const KFileItemLis...
[dolphin.git] / src / treeviewsidebarpage.cpp
index 8f88876979491082921ab8e1f25bba911cf3e408..7b434a495c62ebd9b33c415f1728a8d70fb932f8 100644 (file)
@@ -51,6 +51,13 @@ TreeViewSidebarPage::~TreeViewSidebarPage()
     m_dirLister = 0;
 }
 
+QSize TreeViewSidebarPage::sizeHint() const
+{
+    QSize size = SidebarPage::sizeHint();
+    size.setWidth(200);
+    return size;
+}
+
 void TreeViewSidebarPage::setUrl(const KUrl& url)
 {
     if (!url.isValid() || (url == SidebarPage::url())) {
@@ -121,9 +128,9 @@ void TreeViewSidebarPage::contextMenuEvent(QContextMenuEvent* event)
     }
 
     const QModelIndex dirModelIndex = m_proxyModel->mapToSource(index);
-    KFileItem* item = m_dirModel->itemForIndex(dirModelIndex);
+    KFileItem item = m_dirModel->itemForIndex(dirModelIndex);
 
-    emit changeSelection(KFileItemList());
+    emit changeSelection(QList<KFileItem>());
     TreeViewContextMenu contextMenu(this, item);
     contextMenu.open();
 }
@@ -159,10 +166,9 @@ void TreeViewSidebarPage::expandSelectionParent()
 void TreeViewSidebarPage::updateActiveView(const QModelIndex& index)
 {
     const QModelIndex dirIndex = m_proxyModel->mapToSource(index);
-    const KFileItem* item = m_dirModel->itemForIndex(dirIndex);
-    if (item != 0) {
-        const KUrl& url = item->url();
-        emit changeUrl(url);
+    const KFileItem item = m_dirModel->itemForIndex(dirIndex);
+    if (!item.isNull()) {
+        emit changeUrl(item.url());
     }
 }
 
@@ -171,10 +177,10 @@ void TreeViewSidebarPage::dropUrls(const KUrl::List& urls,
 {
     if (index.isValid()) {
         const QModelIndex dirIndex = m_proxyModel->mapToSource(index);
-        KFileItem* item = m_dirModel->itemForIndex(dirIndex);
-        Q_ASSERT(item != 0);
-        if (item->isDir()) {
-            emit urlsDropped(urls, item->url());
+        KFileItem item = m_dirModel->itemForIndex(dirIndex);
+        Q_ASSERT(!item.isNull());
+        if (item.isDir()) {
+            emit urlsDropped(urls, item.url());
         }
     }
 }