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

List:       kde-commits
Subject:    [kwalletmanager] src/manager: Minor optimization
From:       Montel Laurent <null () kde ! org>
Date:       2017-07-03 5:42:06
Message-ID: E1dRu7a-0007T9-R0 () code ! kde ! org
[Download RAW message or body]

Git commit b279e1d6b28248d215415ff3ab2a3ee658b22c54 by Montel Laurent.
Committed on 03/07/2017 at 05:41.
Pushed by mlaurent into branch 'master'.

Minor optimization

M  +6    -6    src/manager/allyourbase.cpp
M  +1    -1    src/manager/allyourbase.h
M  +1    -1    src/manager/connectedappmodel.cpp
M  +3    -3    src/manager/kwalleteditor.cpp
M  +2    -2    src/manager/kwalletmanager.cpp
M  +1    -1    src/manager/kwmapeditor.cpp
M  +1    -1    src/manager/main.cpp

https://commits.kde.org/kwalletmanager/b279e1d6b28248d215415ff3ab2a3ee658b22c54

diff --git a/src/manager/allyourbase.cpp b/src/manager/allyourbase.cpp
index 84058ad..25e3e5c 100644
--- a/src/manager/allyourbase.cpp
+++ b/src/manager/allyourbase.cpp
@@ -51,11 +51,11 @@ QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group \
group)  {
     QPixmap pix = QIcon::fromTheme(_name).pixmap(IconSize(group), IconSize(group));
 
-    if (pix.isNull())
+    if (pix.isNull()) {
         pix = QIcon::fromTheme(_name.toLower()).pixmap(IconSize(group), \
                IconSize(group));
-
-    if (pix.isNull())
-        pix = QIcon::fromTheme(QStringLiteral("folder-red")).pixmap(IconSize(group), \
IconSize(group)); +        if (pix.isNull())
+            pix = QIcon::fromTheme(QStringLiteral("folder-red")).pixmap(IconSize(group), \
IconSize(group)); +    }
 
     return pix;
 }
@@ -359,11 +359,11 @@ void KWalletItem::processDropEvent(QDropEvent *e)
 /****************
  *  KWalletEntryList - A listview to store wallet entries
  */
-KWalletEntryList::KWalletEntryList(QWidget *parent, const char *name)
+KWalletEntryList::KWalletEntryList(QWidget *parent, const QString &name)
     : QTreeWidget(parent),
       _wallet(0)
 {
-    setObjectName(QLatin1String(name));
+    setObjectName(name);
     setColumnCount(1);
     setHeaderLabel(i18n("Folders"));
     setRootIsDecorated(true);
diff --git a/src/manager/allyourbase.h b/src/manager/allyourbase.h
index 7da25ce..5c26781 100644
--- a/src/manager/allyourbase.h
+++ b/src/manager/allyourbase.h
@@ -108,7 +108,7 @@ class KWalletEntryList : public QTreeWidget
     Q_OBJECT
 
 public:
-    explicit KWalletEntryList(QWidget *parent, const char *name = nullptr);
+    explicit KWalletEntryList(QWidget *parent, const QString &name = QString());
     virtual ~KWalletEntryList();
 
     bool existsFolder(const QString &name);
diff --git a/src/manager/connectedappmodel.cpp b/src/manager/connectedappmodel.cpp
index 34542a5..b847c13 100644
--- a/src/manager/connectedappmodel.cpp
+++ b/src/manager/connectedappmodel.cpp
@@ -39,7 +39,7 @@ void ConnectedAppModel::refresh()
     Q_FOREACH(const QString &appName, _connectedApps) {
         // for un unknown reason, kwalletd returs empty strings so lets avoid \
inserting them  // FIXME: find out why kwalletd returns empty strings here
-        if (appName.length() > 0) {
+        if (!appName.isEmpty()) {
             QStandardItem *item = new QStandardItem(appName);
             item->setEditable(false);
             setItem(row, 0, item);
diff --git a/src/manager/kwalleteditor.cpp b/src/manager/kwalleteditor.cpp
index 61b74ae..df22ebc 100644
--- a/src/manager/kwalleteditor.cpp
+++ b/src/manager/kwalleteditor.cpp
@@ -1287,7 +1287,7 @@ void KWalletEditor::onSearchTextChanged(const QString &text)
             _entryList->setCurrentItem(NULL);
             // NOTE: the 300 ms here is a value >200 ms used internally by \
                KTreeWidgetSearchLine
             // TODO: replace this timer with a connection to \
                KTreeWidgetSearchLine::searchUpdated signal introduced with KF5
-            QTimer::singleShot(300, _entryList, SLOT(collapseAll()));
+            QTimer::singleShot(300, _entryList, &KWalletEntryList::collapseAll);
             treeIsExpanded = false;
         }
     } else {
@@ -1297,10 +1297,10 @@ void KWalletEditor::onSearchTextChanged(const QString &text)
         }
         // NOTE: the 300 ms here is a value >200 ms used internally by \
                KTreeWidgetSearchLine
         // TODO: replace this timer with a connection to \
                KTreeWidgetSearchLine::searchUpdated signal introduced with KF5
-        QTimer::singleShot(300, _entryList, SLOT(selectFirstVisible()));
+        QTimer::singleShot(300, _entryList, &KWalletEntryList::selectFirstVisible);
     }
     // TODO: reduce timer count when KTreeWidgetSearchLine::searchUpdated signal \
                will be there
-    QTimer::singleShot(300, _entryList, SLOT(refreshItemsCount()));
+    QTimer::singleShot(300, _entryList, &KWalletEntryList::refreshItemsCount);
 }
 
 void KWalletEditor::onAlwaysShowContents(bool checked)
diff --git a/src/manager/kwalletmanager.cpp b/src/manager/kwalletmanager.cpp
index 1f3a924..229004d 100644
--- a/src/manager/kwalletmanager.cpp
+++ b/src/manager/kwalletmanager.cpp
@@ -92,7 +92,7 @@ void KWalletManager::configUI() {
         //connect(_tray, SIGNAL(quitSelected()), SLOT(shuttingDown()));
         const QStringList wl = KWallet::Wallet::walletList();
         bool isOpen = false;
-        for (QStringList::ConstIterator it = wl.begin(); it != wl.end(); ++it) {
+        for (QStringList::ConstIterator it = wl.begin(), end = wl.end(); it != end; \
++it) {  if (KWallet::Wallet::isOpen(*it)) {
                 _tray->setIconByName(QStringLiteral("wallet-open"));
                 _tray->setToolTip(QStringLiteral("wallet-open"), i18n("Wallet"), \
i18n("A wallet is open.")); @@ -343,7 +343,7 @@ void KWalletManager::createWallet()
         }
 
         name = lineEdit->text();
-        if (name.isEmpty()) {
+        if (name.trimmed().isEmpty()) {
             return;
         }
 
diff --git a/src/manager/kwmapeditor.cpp b/src/manager/kwmapeditor.cpp
index fed8e93..c714b58 100644
--- a/src/manager/kwmapeditor.cpp
+++ b/src/manager/kwmapeditor.cpp
@@ -169,7 +169,7 @@ void KWMapEditor::reload()
     }
 
     row = 0;
-    for (QMap<QString, QString>::Iterator it = _map.begin(); it != _map.end(); ++it) \
{ +    for (QMap<QString, QString>::Iterator it = _map.begin(), end = _map.end(); it \
!= end; ++it) {  item(row, 1)->setText(it.key());
         item(row, 2)->setText(it.value());
         row++;
diff --git a/src/manager/main.cpp b/src/manager/main.cpp
index c2b6957..4cfae50 100644
--- a/src/manager/main.cpp
+++ b/src/manager/main.cpp
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
                  QStringLiteral(KWALLETMANAGER_VERSION_STRING),
                  i18n("KDE Wallet Management Tool"),
                  KAboutLicense::GPL,
-                 i18n("Copyright  ©2013–2015, KWallet Manager authors"),
+                 i18n("Copyright  ©2013–2017, KWallet Manager authors"),
                  QString(),
                  QStringLiteral("http://utils.kde.org/projects/kwalletmanager"));
 


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

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