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

List:       kde-commits
Subject:    kdegraphics/kpovmodeler
From:       Leon Pennington <leon () leonscape ! co ! uk>
Date:       2004-07-03 0:33:35
Message-ID: 20040703003335.D980199B3 () office ! kde ! org
[Download RAW message or body]

CVS commit by leonp: 

Fixed some bugs drag and drop now works properly in Library Browser


  M +8 -8      pmlibraryiconview.cpp   1.8
  M +4 -0      pmlibraryiconview.h   1.7


--- kdegraphics/kpovmodeler/pmlibraryiconview.cpp  #1.7:1.8
@@ -219,4 +219,6 @@ void PMLibraryIconViewItem::dropped( QDr
    if( m_isSubLibrary && PMLibraryIconDrag::decode( e, pathList, subLibList ) )
    {
+      PMLibraryIconView* source = static_cast<PMLibraryIconView*>( e->source( \
)->parentWidget( ) ); +      PMLibraryHandle* parentLib = source->library( );
       PMLibraryHandle newParentLib = PMLibraryHandle( m_path );
       for( unsigned i = 0; i < pathList.count( ); ++i )
@@ -224,10 +226,7 @@ void PMLibraryIconViewItem::dropped( QDr
          bool success = true;
          QString path = pathList[i];
-         QString parentLibPath = path;
-         parentLibPath.remove( parentLibPath.section( '/', -1 ) );
-         PMLibraryHandle parentLib = PMLibraryHandle( parentLibPath );
          if( subLibList[i] )
          {
-            if( parentLib.deleteSubLibrary( path ) == PMLibraryHandle::Ok )
+            if( parentLib->deleteSubLibrary( path ) == PMLibraryHandle::Ok )
             {
                PMLibraryHandle lib = PMLibraryHandle( path );
@@ -241,5 +240,5 @@ void PMLibraryIconViewItem::dropped( QDr
                {
                   success = false;
-                  parentLib.addSubLibrary( path, lib.name( ) );
+                  parentLib->addSubLibrary( path, lib.name( ) );
                }
             }
@@ -249,5 +248,5 @@ void PMLibraryIconViewItem::dropped( QDr
          else
          {
-            if( parentLib.deleteObject( path ) == PMLibraryHandle::Ok )
+            if( parentLib->deleteObject( path ) == PMLibraryHandle::Ok )
             {
                PMLibraryObject obj = PMLibraryObject( path );
@@ -260,5 +259,5 @@ void PMLibraryIconViewItem::dropped( QDr
                {
                   success = false;
-                  parentLib.addObject( path, obj.name( ) );
+                  parentLib->addObject( path, obj.name( ) );
                }
             }
@@ -269,5 +268,5 @@ void PMLibraryIconViewItem::dropped( QDr
          if( !success )
          {
-            KMessageBox::error( 0, i18n( "Error moving \"%1\" to \"%2\"\nLibrary \
maybe damaged" ).arg( path ).arg( m_path ) ); +            KMessageBox::error( 0, \
i18n( "Error moving \"%1\" to \"%2\"" ).arg( path ).arg( m_path ) );  e->ignore( );
             return;
@@ -275,4 +274,5 @@ void PMLibraryIconViewItem::dropped( QDr
       }
       e->acceptAction( );
+      source->refresh( );
    }
    else

--- kdegraphics/kpovmodeler/pmlibraryiconview.h  #1.6:1.7
@@ -70,4 +70,8 @@ public:
     */
    void setLibrary( PMLibraryHandle* h );
+   /**
+    * Returns the library in view
+    */
+   PMLibraryHandle* library( ) const { return m_pLibrary; }
 
 public slots:


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

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