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

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/dialogs
From:       Nikolaj Hald Nielsen <nhnFreespirit () gmail ! com>
Date:       2009-03-20 14:28:01
Message-ID: 1237559281.923197.21473.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 941807 by nhnielsen:

Toggle up and down buttons in sane way


 M  +34 -0     PlaylistLayoutEditDialog.cpp  
 M  +1 -0      PlaylistLayoutEditDialog.h  


--- trunk/extragear/multimedia/amarok/src/dialogs/PlaylistLayoutEditDialog.cpp \
#941806:941807 @@ -97,6 +97,7 @@
     connect( previewButton, SIGNAL( clicked() ), this, SLOT( preview() ) );
     connect( layoutListWidget, SIGNAL( currentTextChanged( const QString & ) ), \
                this, SLOT( setLayout( const QString & ) ) );
     connect( layoutListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( \
toggleDeleteButton() ) ); +    connect( layoutListWidget, SIGNAL( currentRowChanged( \
int ) ), this, SLOT( toggleUpDownButtons() ) );  
     connect( moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUp() ) );
     connect( moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDown() ) );
@@ -121,6 +122,8 @@
     renameLayoutButton->setIcon( renameIcon );
     renameLayoutButton->setToolTip( i18n( "Rename playlist layout" ) );
     connect( renameLayoutButton, SIGNAL( clicked() ), this, SLOT( renameLayout() ) \
); +
+    toggleUpDownButtons();
 }
 
 
@@ -297,6 +300,35 @@
         deleteLayoutButton->setEnabled( 1 );
 }
 
+void PlaylistLayoutEditDialog::toggleUpDownButtons()
+{
+    if ( !layoutListWidget->currentItem() )
+    {
+        moveUpButton->setEnabled( 0 );
+        moveDownButton->setEnabled( 0 );
+    }
+    else if ( layoutListWidget->currentRow() == 0 )
+    {
+        moveUpButton->setEnabled( 0 );
+        if ( layoutListWidget->currentRow() >= m_layoutsMap->size() -1 )
+            moveDownButton->setEnabled( 0 );
+        else
+            moveDownButton->setEnabled( 1 );
+    }
+    else if ( layoutListWidget->currentRow() >= m_layoutsMap->size() -1 )
+    {
+        moveDownButton->setEnabled( 0 );
+        moveUpButton->setEnabled( 1 ); //we already cheked that this is not row 0
+    }
+    else
+    {
+        moveDownButton->setEnabled( 1 );
+        moveUpButton->setEnabled( 1 );
+    }
+        
+    
+}
+
 /**
  * Saves the edited layouts from m_layoutMap to the LayoutManager and closes the \
                dialog.
  */
@@ -363,5 +395,7 @@
 }
 
 
+
+
 #include "PlaylistLayoutEditDialog.moc"
 
--- trunk/extragear/multimedia/amarok/src/dialogs/PlaylistLayoutEditDialog.h \
#941806:941807 @@ -53,6 +53,7 @@
         void moveUp();
         void moveDown();
         void toggleDeleteButton();
+        void toggleUpDownButtons();
 
     private:
         Playlist::LayoutEditWidget *m_headEdit;


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

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