Commit 1b95fce2 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent e334a957
...@@ -125,9 +125,7 @@ KContacts::Email MailWidget::email() ...@@ -125,9 +125,7 @@ KContacts::Email MailWidget::email()
value.append(QStringLiteral("PREF")); value.append(QStringLiteral("PREF"));
} }
} else { } else {
if (value.contains(QStringLiteral("PREF"))) { value.removeAll(QStringLiteral("PREF"));
value.removeAll(QStringLiteral("PREF"));
}
} }
if (!value.isEmpty()) { if (!value.isEmpty()) {
parameters.insert(QStringLiteral("type"), value); parameters.insert(QStringLiteral("type"), value);
......
...@@ -128,9 +128,7 @@ KContacts::ResourceLocatorUrl WebWidget::url() ...@@ -128,9 +128,7 @@ KContacts::ResourceLocatorUrl WebWidget::url()
value.append(QStringLiteral("PREF")); value.append(QStringLiteral("PREF"));
} }
} else { } else {
if (value.contains(QStringLiteral("PREF"))) { value.removeAll(QStringLiteral("PREF"));
value.removeAll(QStringLiteral("PREF"));
}
} }
if (!value.isEmpty()) { if (!value.isEmpty()) {
parameters.insert(QStringLiteral("type"), value); parameters.insert(QStringLiteral("type"), value);
......
...@@ -343,11 +343,13 @@ public: ...@@ -343,11 +343,13 @@ public:
mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems,
ki18np("Copy Contact", "Copy %1 Contacts")); ki18np("Copy Contact", "Copy %1 Contacts"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu)) { QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu)->setText(i18n("Copy Contact To")); if (act) {
act->setText(i18n("Copy Contact To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog)) { act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog)->setText(i18n("Copy Contact To")); if (act) {
act->setText(i18n("Copy Contact To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) { if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems,
...@@ -357,25 +359,30 @@ public: ...@@ -357,25 +359,30 @@ public:
mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems,
ki18np("Cut Contact", "Cut %1 Contacts")); ki18np("Cut Contact", "Cut %1 Contacts"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu)) { act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu)->setText(i18n("Move Contact To")); if (act) {
act->setText(i18n("Move Contact To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog)) { act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog)->setText(i18n("Move Contact To")); if (act) {
act->setText(i18n("Move Contact To"));
} }
if (mActions.contains(StandardContactActionManager::EditItem)) { act = mActions.value(StandardContactActionManager::EditItem);
mActions.value(StandardContactActionManager::EditItem)->setText(i18n("Edit Contact...")); if (act) {
act->setText(i18n("Edit Contact..."));
} }
} else if (mimeType == KContacts::ContactGroup::mimeType()) { } else if (mimeType == KContacts::ContactGroup::mimeType()) {
if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) { if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) {
mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems,
ki18np("Copy Group", "Copy %1 Groups")); ki18np("Copy Group", "Copy %1 Groups"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu)) { QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu)->setText(i18n("Copy Group To")); if (act) {
act->setText(i18n("Copy Group To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog)) { act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog)->setText(i18n("Copy Group To")); if (act) {
act->setText(i18n("Copy Group To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) { if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems,
...@@ -385,14 +392,17 @@ public: ...@@ -385,14 +392,17 @@ public:
mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems,
ki18np("Cut Group", "Cut %1 Groups")); ki18np("Cut Group", "Cut %1 Groups"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu)) { act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu)->setText(i18n("Move Group To")); if (act) {
act->setText(i18n("Move Group To"));
} }
if (mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog)) { act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog)->setText(i18n("Move Group To")); if (act) {
act->setText(i18n("Move Group To"));
} }
if (mActions.contains(StandardContactActionManager::EditItem)) { act = mActions.value(StandardContactActionManager::EditItem);
mActions.value(StandardContactActionManager::EditItem)->setText(i18n("Edit Group...")); if (act) {
act->setText(i18n("Edit Group..."));
} }
} }
} }
......
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