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

List:       kde-commits
Subject:    [ring-kde/accountdlg_rewrite2] src: action: Always enable the "Add new" action
From:       Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date:       2015-06-19 16:12:10
Message-ID: E1Z5ytm-0003ne-Qi () scm ! kde ! org
[Download RAW message or body]

Git commit e382d2b34b79e5b2e7258b7268e60dfdef2d3091 by Emmanuel Lepage Vallee.
Committed on 17/06/2015 at 21:11.
Pushed by lepagevalleeemmanuel into branch 'accountdlg_rewrite2'.

action: Always enable the "Add new" action

It doesn't make sense for other Ring clients as they don't
use a toolbar, but given the KDE client have one anyway,
better make good use of it.

Refs #75503

M  +7    -2    src/actioncollection.cpp

http://commits.kde.org/ring-kde/e382d2b34b79e5b2e7258b7268e60dfdef2d3091

diff --git a/src/actioncollection.cpp b/src/actioncollection.cpp
index b7287c5..f2863e9 100755
--- a/src/actioncollection.cpp
+++ b/src/actioncollection.cpp
@@ -244,15 +244,20 @@ void ActionCollection::setupAction()
       const int first(tl.row()),last(br.row());
       for(int i = first; i <= last;i++) {
          const QModelIndex& idx = uam->index(i,0);
-         QAction* a = \
actionHash[(int)qvariant_cast<UserActionModel::Action>(idx.data(UserActionModel::Role::ACTION))]; +       \
const UserActionModel::Action action = \
qvariant_cast<UserActionModel::Action>(idx.data(UserActionModel::Role::ACTION)); +         QAction* a = \
actionHash[(int)action];  if (a) {
             a->setText   ( idx.data(Qt::DisplayRole).toString()                 );
-            a->setEnabled( idx.flags() & Qt::ItemIsEnabled                      );
+
+            if (action != UserActionModel::Action::ADD_NEW) //HACK
+               a->setEnabled( idx.flags() & Qt::ItemIsEnabled                   );
+
             a->setChecked( idx.data(Qt::CheckStateRole) == Qt::Checked          );
          }
       }
    });
 
+
    /**/connect(MacroModel::instance()           ,       SIGNAL(addAction(QVariant)),  this    , \
SLOT(addMacro(QVariant))          );  /**/connect(action_mailBox                   ,               \
SIGNAL(triggered()),           this    , SLOT(mailBox())                   );  \
/**/connect(action_displayVolumeControls     ,   SIGNAL(toggled(bool)),         Ring::view() , \
SLOT(displayVolumeControls(bool)) );


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

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