[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-06-30 3:32:38
Message-ID: 20040630033238.23C1B9981 () office ! kde ! org
[Download RAW message or body]

CVS commit by leonp: 

Altered selection behaviour in Library Browser, also added ability to delete
sub libraries.


  M +38 -22    pmlibrarybrowser.cpp   1.9
  M +2 -1      pmlibrarybrowser.h   1.7
  M +2 -1      pmlibraryiconview.cpp   1.4


--- kdegraphics/kpovmodeler/pmlibrarybrowser.cpp  #1.8:1.9
@@ -111,4 +111,6 @@ PMLibraryBrowserViewWidget::PMLibraryBro
    connect( m_pLibraryIconView, SIGNAL( selectionChanged( QIconViewItem* ) ),
                                 SLOT( slotSelectionChanged( QIconViewItem* ) ) );
+   connect( m_pLibraryIconView, SIGNAL( executed( QIconViewItem* ) ),
+                                SLOT( slotSelectionExecuted( QIconViewItem* ) ) );
 
    // Set the selected library
@@ -149,4 +151,15 @@ void PMLibraryBrowserViewWidget::slotSel
    m_pLibraryIconView->setCurrentItem( sel );
    if( sel->isSubLibrary( ) )
+      m_pLibraryObjectPreview->clearPreview( );
+   else
+      m_pLibraryObjectPreview->showPreview( sel->path( ) );
+   m_pLibraryIconView->setFocus();
+}
+
+void PMLibraryBrowserViewWidget::slotSelectionExecuted( QIconViewItem* item )
+{
+   PMLibraryIconViewItem* sel = static_cast<PMLibraryIconViewItem*>( item );
+   m_pLibraryIconView->setCurrentItem( sel );
+   if( sel->isSubLibrary( ) )
    {
       // It's a sub library
@@ -155,7 +168,9 @@ void PMLibraryBrowserViewWidget::slotSel
       QTimer::singleShot( 100, this, SLOT( slotIconViewSetLibrary( ) ) );
       m_pUpButton->setEnabled( true );
-   } else
+   }
+   else
       // It's an object
       m_pLibraryObjectPreview->showPreview( sel->path( ) );
+   m_pLibraryIconView->setFocus();
 }
 
@@ -182,11 +197,13 @@ void PMLibraryBrowserViewWidget::slotDel
 {
    PMLibraryIconViewItem* sel = static_cast<PMLibraryIconViewItem*>( \
                m_pLibraryIconView->currentItem( ) );
-   if( sel->isSubLibrary( ) )
-   {
-      // need a recursive function to delete
-   }
+   PMLibraryHandle::PMResult rst;
+   if( !sel )
+      return;
+   else if( sel->isSubLibrary( ) )
+      rst = m_pCurrentLibrary->deleteSubLibrary( sel->path( ) );
    else
-   {
-      switch( m_pCurrentLibrary->deleteObject( sel->path( ) ) )
+      rst = m_pCurrentLibrary->deleteObject( sel->path( ) );
+
+   switch( rst )
       {
          case PMLibraryHandle::Ok:
@@ -201,11 +218,10 @@ void PMLibraryBrowserViewWidget::slotDel
             break;
          case PMLibraryHandle::NotInLib:
-            KMessageBox::error( this, i18n( "The current library does not contain \
object." ), i18n( "Error" ) ); +         KMessageBox::error( this, i18n( "The current \
library does not contain that item." ), i18n( "Error" ) );  break;
          default:
-            KMessageBox::error( this, i18n( "Could not remove object." ), i18n( \
"Error" ) ); +         KMessageBox::error( this, i18n( "Could not remove item." ), \
i18n( "Error" ) );  break;
       }
-   }
 }
 

--- kdegraphics/kpovmodeler/pmlibrarybrowser.h  #1.6:1.7
@@ -73,5 +73,6 @@ private slots:
    void resizeEvent( QResizeEvent* ev );
    void slotPathSelected( const QString& str );
-   void slotSelectionChanged( QIconViewItem* str );
+   void slotSelectionChanged( QIconViewItem* item );
+   void slotSelectionExecuted( QIconViewItem* item );
    void slotUpButtonClicked( );
    void slotEditClicked( );

--- kdegraphics/kpovmodeler/pmlibraryiconview.cpp  #1.3:1.4
@@ -36,4 +36,5 @@ PMLibraryIconView::PMLibraryIconView( QW
    m_pCurrentLibrary = NULL;
    setSelectionMode( Single );
+   setMode( Execute );
    setItemsMovable( false );
    setAcceptDrops( false );


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

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