[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [Amarok] 36b70c1: Do not show context menu when right cliking the fi
From:       Nikolaj Hald Nielsen <nhnFreespirit () gmail ! com>
Date:       2010-05-16 8:51:10
Message-ID: 201005160851.o4G8pAP5015558 () kore ! kollide ! net
[Download RAW message or body]

commit 36b70c1d1c6741fdb8c327483e1395b7eaf496da
Author: Nikolaj Hald Nielsen <nhnFreespirit@gmail.com>
Date:   Sun May 16 10:49:29 2010 +0200

    Do not show context menu when right cliking the file browser in "places" mode as \
that can lead to any number of different crashes...  
    BUG: 237562

diff --git a/src/browsers/filebrowser/FileBrowser.cpp \
b/src/browsers/filebrowser/FileBrowser.cpp index b12f26a..a892e01 100644
--- a/src/browsers/filebrowser/FileBrowser.cpp
+++ b/src/browsers/filebrowser/FileBrowser.cpp
@@ -420,6 +420,7 @@ FileBrowser::showPlaces()
     if( !m_placesModel )
     {
         m_placesModel = new KFilePlacesModel( this );
+        m_placesModel->setObjectName( "PLACESMODEL");
         connect( m_placesModel, SIGNAL( setupDone( const QModelIndex &, bool ) ), \
this, SLOT( setupDone( const QModelIndex &, bool ) ) );  }
 
diff --git a/src/browsers/filebrowser/FileView.cpp \
b/src/browsers/filebrowser/FileView.cpp index 1a912de..6c5b2ad 100644
--- a/src/browsers/filebrowser/FileView.cpp
+++ b/src/browsers/filebrowser/FileView.cpp
@@ -77,9 +77,21 @@ void
 FileView::contextMenuEvent ( QContextMenuEvent * e )
 {
 
+    DEBUG_BLOCK
+
     if( !model() )
         return;
 
+
+    //trying to do fancy stuff while showing places only leads to tears!
+    debug() << model()->objectName();
+    if( model()->objectName() == "PLACESMODEL" )
+    {
+        e->accept();
+        return;
+    }
+    
+
     QModelIndexList indices = selectedIndexes();
 
     // Abort if nothing is selected
@@ -435,6 +447,11 @@ FileView::tracksForEdit() const
 
     foreach( const QModelIndex& index, indices )
     {
+        //yes, the spaces in the string are supposed to be there... Yes, that is
+        //quite strange. No, I have no idea why they are there...
+        if( index.data( KDirModel::FileItemRole ).typeName() != " KFileItem " )
+            return tracks;
+        
         KFileItem item = index.data( KDirModel::FileItemRole ).value<KFileItem>();
         Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( \
item.url() );  if( track )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic