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

List:       kde-commits
Subject:    [amarok] /: Add the AppletToolbarConfigItem even when no applets
From:       Nikhil Marathe <nsm.nikhil () gmail ! com>
Date:       2011-08-23 5:32:00
Message-ID: 20110823053200.3D8EEA6078 () git ! kde ! org
[Download RAW message or body]

Git commit 167b91ac446f51f8ef64d9a1b7d666d2ab7d3386 by Nikhil Marathe.
Committed on 21/08/2011 at 09:29.
Pushed by nikhilm into branch 'master'.

Add the AppletToolbarConfigItem even when no applets are present.

BUG: 280382
REVIEW: 102395

Move config wrench initialization to constructor.

Creating the wrench only when an applet is added prevents it from being
added when no applets are present in the ContextView.

refactor AppletToolbarAppletItem creation

Since its always null in the constructor, remove the check

Added bugfix to changelog

M  +11   -24   src/context/toolbar/AppletToolbar.cpp
M  +2    -0    ChangeLog

http://commits.kde.org/amarok/167b91ac446f51f8ef64d9a1b7d666d2ab7d3386

diff --git a/ChangeLog b/ChangeLog
index d7b87fd..cb59f07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@ Version 2.4.4-Beta 1
     * Current track applet: show number of artists instead of genres. (BR 261077)
 
   BUGFIXES:
+    * Fixed issue where the Context View wrench was not created when the
+      Context View had no applets. (BR 280382)
     * Fixed off-by-one error in organize collection dialog.
     * Fixed issue that made TagGuesser dialog to forget setings. (BR 280288)
     * Fixed tags guessing from full file path. (BR 264302)
diff --git a/src/context/toolbar/AppletToolbar.cpp b/src/context/toolbar/AppletToolbar.cpp
index 2bedf38..2cfda7c 100644
--- a/src/context/toolbar/AppletToolbar.cpp
+++ b/src/context/toolbar/AppletToolbar.cpp
@@ -55,6 +55,11 @@ Context::AppletToolbar::AppletToolbar( QGraphicsItem* parent )
     m_appletLayout->setContentsMargins( 3, 3, 3, 3 );
     m_appletLayout->setSpacing( 4 );
 
+    m_configItem = new AppletToolbarConfigItem( this );
+    connect( m_configItem, SIGNAL( triggered() ), this, SLOT( toggleConfigMode() ) );
+    m_appletLayout->addItem( m_configItem );
+    m_appletLayout->setAlignment( m_configItem, Qt::AlignRight );
+    m_appletLayout->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
 }
 
 Context::AppletToolbar::~AppletToolbar()
@@ -143,31 +148,13 @@ Context::AppletToolbar::appletAdded( Plasma::Applet* applet, int loc ) // SLOT
     DEBUG_BLOCK
 
     debug() << "inserting applet icon in position" << loc;
-    if( !m_configItem )
-    {
-        m_configItem = new AppletToolbarConfigItem( this );
-        connect( m_configItem, SIGNAL( triggered() ), this, SLOT( toggleConfigMode() ) );
-        m_appletLayout->addItem( m_configItem );
-        m_appletLayout->setAlignment( m_configItem, Qt::AlignRight );
-    }
-
-    if( m_configMode )
-    {
-        Context::AppletToolbarAppletItem* item = new Context::AppletToolbarAppletItem( this, applet );
-        item->setConfigEnabled( true );
-        connect( item, SIGNAL( appletChosen( Plasma::Applet* ) ),
-                 this, SIGNAL( showApplet( Plasma::Applet* ) ) );
+    Context::AppletToolbarAppletItem* item = new Context::AppletToolbarAppletItem( this, applet );
+    item->setConfigEnabled( m_configMode );
+    connect( item, SIGNAL( appletChosen( Plasma::Applet* ) ),
+             this, SIGNAL( showApplet( Plasma::Applet* ) ) );
 
-        // add the item
-        m_appletLayout->insertItem( loc, item );
-    }
-    else
-    {
-        Context::AppletToolbarAppletItem* item = new Context::AppletToolbarAppletItem( this, applet );
-        connect( item, SIGNAL( appletChosen( Plasma::Applet* ) ),
-                 this, SIGNAL( showApplet( Plasma::Applet* ) ) );
-        m_appletLayout->insertItem( loc, item );
-    }
+    // add the item
+    m_appletLayout->insertItem( loc, item );
 
     // notifications for others who need to know when the layout is done adding the applet
     emit appletAddedToToolbar( applet, loc );

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

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