summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-07-03 07:41:59 +0200
committerMontel Laurent <[email protected]>2017-07-03 07:41:59 +0200
commitb279e1d6b28248d215415ff3ab2a3ee658b22c54 (patch)
tree8c4fb78555ae0a9aadf99fc0a28ee3af4ab5d877
parenta8f234b035854b118756b9966a4b36d4ba0a9c17 (diff)
Minor optimization
-rw-r--r--src/manager/allyourbase.cpp12
-rw-r--r--src/manager/allyourbase.h2
-rw-r--r--src/manager/connectedappmodel.cpp2
-rw-r--r--src/manager/kwalleteditor.cpp6
-rw-r--r--src/manager/kwalletmanager.cpp4
-rw-r--r--src/manager/kwmapeditor.cpp2
-rw-r--r--src/manager/main.cpp2
7 files changed, 15 insertions, 15 deletions
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"));