Commit b279e1d6 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent a8f234b0
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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++;
......
......@@ -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"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment