diff --git a/kcm/akonadicontactactions.ui b/kcm/akonadicontactactions.ui
index c961cb3c..e5c54702 100644
--- a/kcm/akonadicontactactions.ui
+++ b/kcm/akonadicontactactions.ui
@@ -1,346 +1,313 @@
AkonadiContactActions004895840000Show Address00000Url:true0000Command:trueQt::Vertical209Dial Phone Number
-
+
- 3
+ 00000Command:truetrue
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 6
-
-
- 0
-
-
-
-
- Command:
-
-
-
-
-
-
-
-
- Qt::Vertical2018Send SMS00000Command:truetrue0000Command:truetrueQt::Vertical2018Qt::Vertical2014KLineEditQLineEditklineedit.hKComboBoxQComboBoxkcombobox.h
diff --git a/kcm/kcmakonadicontactactions.cpp b/kcm/kcmakonadicontactactions.cpp
index 5ac778f5..6e807d34 100644
--- a/kcm/kcmakonadicontactactions.cpp
+++ b/kcm/kcmakonadicontactactions.cpp
@@ -1,159 +1,157 @@
/*
This file is part of Akonadi Contact.
Copyright (C) 2013-2019 Laurent Montel
Copyright (c) 2009 Tobias Koenig
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "kcmakonadicontactactions.h"
#include "contactactionssettings.h"
#include
#include
#include
#include
Q_DECLARE_METATYPE(ContactActionsSettings::EnumDialPhoneNumberAction)
K_PLUGIN_FACTORY(KCMAkonadiContactActionsFactory, registerPlugin();
)
KCMAkonadiContactActions::KCMAkonadiContactActions(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
KAboutData *about = new KAboutData(QStringLiteral("kcmakonadicontactactions"),
i18n("Contact Actions Settings"),
QString(), QString(), KAboutLicense::LGPL,
i18n("(c) 2009 Tobias Koenig"));
about->addAuthor(i18n("Tobias Koenig"), QString(), QStringLiteral("tokoe@kde.org"));
setAboutData(about);
ui.setupUi(this);
mConfigManager = addConfig(ContactActionsSettings::self(), this);
+ ui.DialPhoneNumberAction->addItem(i18n("System Default"), ContactActionsSettings::UseSystemDefault);
ui.DialPhoneNumberAction->addItem(i18n("Skype"), ContactActionsSettings::UseSkype);
ui.DialPhoneNumberAction->addItem(i18n("Ekiga"), ContactActionsSettings::UseEkiga);
ui.DialPhoneNumberAction->addItem(i18n("SflPhone"), ContactActionsSettings::UseSflPhone);
- ui.DialPhoneNumberAction->addItem(i18n("kdeconnect"), ContactActionsSettings::UseKdeConnectPhone);
ui.DialPhoneNumberAction->addItem(i18n("External Application"), ContactActionsSettings::UseExternalPhoneApplication);
connect(ui.DialPhoneNumberAction, QOverload::of(&KComboBox::currentIndexChanged), this, &KCMAkonadiContactActions::slotDialPhoneNumberActionChanged);
ui.SendSmsAction->addItem(i18n("Skype"), ContactActionsSettings::UseSkypeSms);
ui.SendSmsAction->addItem(i18n("SflPhone"), ContactActionsSettings::UseSflPhoneSms);
ui.SendSmsAction->addItem(i18n("kdeconnect"), ContactActionsSettings::UseKdeConnectSms);
ui.SendSmsAction->addItem(i18n("External Application"), ContactActionsSettings::UseExternalSmsApplication);
connect(ui.SendSmsAction, QOverload::of(&KComboBox::currentIndexChanged), this, &KCMAkonadiContactActions::slotSmsPhoneNumberActionChanged);
ui.ShowAddressAction->addItem(i18n("Web Browser"), ContactActionsSettings::UseBrowser);
ui.ShowAddressAction->addItem(i18n("External Application"), ContactActionsSettings::UseExternalAddressApplication);
ui.ShowAddressAction->addItem(i18n("Google map"), ContactActionsSettings::UseGooglemap);
ui.ShowAddressAction->addItem(i18n("Map quest"), ContactActionsSettings::UseMapquest);
ui.ShowAddressAction->addItem(i18n("OpenStreetMap"), ContactActionsSettings::UseOpenStreetMap);
connect(ui.ShowAddressAction, QOverload::of(&KComboBox::currentIndexChanged), this, &KCMAkonadiContactActions::slotShowAddressActionChanged);
load();
}
void KCMAkonadiContactActions::slotShowAddressActionChanged(int value)
{
ContactActionsSettings::EnumShowAddressAction enumValue = static_cast(ui.ShowAddressAction->itemData(value).toInt());
if (enumValue == ContactActionsSettings::UseBrowser) {
ui.stackedWidget->setCurrentIndex(0);
} else if (enumValue == ContactActionsSettings::UseExternalAddressApplication) {
ui.stackedWidget->setCurrentIndex(1);
} else {
ui.stackedWidget->setCurrentIndex(2);
}
Q_EMIT changed(true);
}
void KCMAkonadiContactActions::slotSmsPhoneNumberActionChanged(int value)
{
ContactActionsSettings::EnumSendSmsAction enumValue = static_cast(ui.SendSmsAction->itemData(value).toInt());
if (enumValue == ContactActionsSettings::UseExternalSmsApplication) {
ui.stackedWidget_3->setCurrentIndex(1);
} else if (enumValue == ContactActionsSettings::UseKdeConnectSms) {
ui.stackedWidget_3->setCurrentIndex(2);
} else {
ui.stackedWidget_3->setCurrentIndex(0);
}
Q_EMIT changed(true);
}
void KCMAkonadiContactActions::slotDialPhoneNumberActionChanged(int value)
{
ContactActionsSettings::EnumDialPhoneNumberAction enumValue = static_cast(ui.DialPhoneNumberAction->itemData(value).toInt());
if (enumValue == ContactActionsSettings::UseExternalPhoneApplication) {
- ui.stackedWidget_2->setCurrentIndex(1);
- } else if (enumValue == ContactActionsSettings::UseKdeConnectPhone) {
- ui.stackedWidget_2->setCurrentIndex(2);
+ ui.phoneDetailsStack->setCurrentIndex(1);
} else {
- ui.stackedWidget_2->setCurrentIndex(0);
+ ui.phoneDetailsStack->setCurrentIndex(0);
}
Q_EMIT changed(true);
}
void KCMAkonadiContactActions::load()
{
mConfigManager->updateWidgets();
ContactActionsSettings::EnumShowAddressAction enumValueAddress = static_cast(ContactActionsSettings::self()->showAddressAction());
const int indexAddress = ui.ShowAddressAction->findData(enumValueAddress);
ui.ShowAddressAction->setCurrentIndex(indexAddress);
ContactActionsSettings::EnumDialPhoneNumberAction enumValue = static_cast(ContactActionsSettings::self()->dialPhoneNumberAction());
const int index = ui.DialPhoneNumberAction->findData(enumValue);
ui.DialPhoneNumberAction->setCurrentIndex(index);
ContactActionsSettings::EnumSendSmsAction enumValueSms = static_cast(ContactActionsSettings::self()->sendSmsAction());
const int indexSms = ui.SendSmsAction->findData(enumValueSms);
ui.SendSmsAction->setCurrentIndex(indexSms);
}
void KCMAkonadiContactActions::save()
{
mConfigManager->updateSettings();
ContactActionsSettings::EnumShowAddressAction enumValueAddress
= static_cast(ui.ShowAddressAction->itemData(ui.ShowAddressAction->currentIndex()).toInt());
ContactActionsSettings::self()->setShowAddressAction(enumValueAddress);
ContactActionsSettings::EnumDialPhoneNumberAction enumValue
= static_cast(ui.DialPhoneNumberAction->itemData(ui.DialPhoneNumberAction->currentIndex()).toInt());
ContactActionsSettings::self()->setDialPhoneNumberAction(enumValue);
ContactActionsSettings::EnumSendSmsAction enumValueSms = static_cast(ui.SendSmsAction->itemData(ui.SendSmsAction->currentIndex()).toInt());
ContactActionsSettings::self()->setSendSmsAction(enumValueSms);
ContactActionsSettings::self()->save();
}
void KCMAkonadiContactActions::defaults()
{
mConfigManager->updateWidgetsDefault();
const bool bUseDefaults = ContactActionsSettings::self()->useDefaults(true);
ui.DialPhoneNumberAction->setCurrentIndex(ContactActionsSettings::self()->dialPhoneNumberAction());
ui.SendSmsAction->setCurrentIndex(ContactActionsSettings::self()->sendSmsAction());
ui.ShowAddressAction->setCurrentIndex(ContactActionsSettings::self()->showAddressAction());
ContactActionsSettings::self()->useDefaults(bUseDefaults);
}
#include "kcmakonadicontactactions.moc"
diff --git a/src/akonadi-contacts/CMakeLists.txt b/src/akonadi-contacts/CMakeLists.txt
index 8c28f244..5d4d63a2 100644
--- a/src/akonadi-contacts/CMakeLists.txt
+++ b/src/akonadi-contacts/CMakeLists.txt
@@ -1,224 +1,223 @@
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5AkonadiContact")
ecm_setup_version(PROJECT VARIABLE_PREFIX AKONADICONTACT
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/akonadi-contact_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfigVersion.cmake"
SOVERSION 5
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiContactConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5AkonadiContactTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AkonadiContactTargets.cmake NAMESPACE KF5::)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiContactConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
-set( AKONADI_PHONE_DIAL_DEFAULT "UseSkype" )
set( AKONADI_SEND_SMS_DEFAULT "UseSkypeSms" )
########### next target ###############
set(akonadicontact_actions_SRCS
actions/dialphonenumberaction.cpp
actions/showaddressaction.cpp
actions/qdialer.cpp
actions/qskypedialer.cpp
actions/sendsmsaction.cpp
actions/smsdialog.cpp
actions/qsflphonedialer.cpp
actions/qekigadialer.cpp
)
configure_file(config-akonadi-contact.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-akonadi-contact.h)
configure_file( actions/contactactionssettings.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/contactactionssettings.kcfg @ONLY)
kconfig_add_kcfg_files(akonadicontact_actions_SRCS actions/contactactionssettings.kcfgc)
set(akonadicontact_attributes_SRCS
attributes/contactmetadataattribute.cpp
attributes/attributeregistrar.cpp
)
set(akonadicontact_job_SRCS
job/contactgroupexpandjob.cpp
job/contactgroupsearchjob.cpp
job/contactsearchjob.cpp
)
set(akonadicontact_LIB_SRC
${akonadicontact_customfieldseditor_SRCS}
${akonadicontact_attributes_SRCS}
${akonadicontact_job_SRCS}
abstractcontactformatter.cpp
abstractcontactgroupformatter.cpp
collectionfiltermodel.cpp
contactcompletionmodel.cpp
contactdefaultactions.cpp
contacteditor.cpp
contacteditordialog.cpp
contactgroupeditor.cpp
contactgroupeditordelegate.cpp
contactgroupeditordialog.cpp
contactgroupmodel.cpp
contactgroupviewer.cpp
contactgroupviewerdialog.cpp
contactmetadataakonadi.cpp
contactparts.cpp
contactsfilterproxymodel.cpp
contactstreemodel.cpp
contactviewer.cpp
contactviewerdialog.cpp
emailaddressselection.cpp
emailaddressselectiondialog.cpp
emailaddressselectionproxymodel.cpp
emailaddressselectionwidget.cpp
emailaddressrequester.cpp
emailaddressselectionmodel.cpp
textbrowser.cpp
leafextensionproxymodel.cpp
standardcontactactionmanager.cpp
standardcontactformatter.cpp
standardcontactgroupformatter.cpp
waitingoverlay.cpp
selectaddressbookdialog.cpp
${akonadicontact_actions_SRCS}
)
ecm_qt_declare_logging_category(akonadicontact_LIB_SRC HEADER akonadi_contact_debug.h IDENTIFIER AKONADICONTACT_LOG CATEGORY_NAME org.kde.pim.akonadicontact)
set(akonadicontact_LIB_SRC
${akonadicontact_LIB_SRC}
)
ki18n_wrap_ui(akonadicontact_LIB_SRC contactgroupeditor.ui)
add_library(KF5AkonadiContact ${akonadicontact_LIB_SRC})
if (BUILD_TESTING)
target_compile_definitions(KF5AkonadiContact PRIVATE BUILD_TESTING)
endif()
generate_export_header(KF5AkonadiContact BASE_NAME akonadi-contact)
add_library(KF5::AkonadiContact ALIAS KF5AkonadiContact)
target_include_directories(KF5AkonadiContact INTERFACE "$")
target_include_directories(KF5AkonadiContact INTERFACE "$")
target_include_directories(KF5AkonadiContact PUBLIC "$")
target_link_libraries(KF5AkonadiContact
PUBLIC
KF5::AkonadiCore
KF5::Contacts
KF5::AkonadiWidgets
Qt5::Widgets
PRIVATE
KF5::ConfigCore
KF5::ConfigWidgets
KF5::IconThemes
KF5::KIOWidgets
KF5::Mime
KF5::DBusAddons
KF5::I18n
KF5::TextWidgets
KF5::XmlGui
KF5::ContactEditor
KF5::Prison
)
set_target_properties(KF5AkonadiContact PROPERTIES
VERSION ${AKONADICONTACT_VERSION_STRING}
SOVERSION ${AKONADICONTACT_SOVERSION}
EXPORT_NAME AkonadiContact
)
install(TARGETS
KF5AkonadiContact
EXPORT KF5AkonadiContactTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
)
ecm_generate_pri_file(BASE_NAME AkonadiContact
LIB_NAME KF5AkonadiContact
DEPS "AkonadiCore Contacts" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/Akonadi/Contact
)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
ecm_generate_headers(AkonadiContactJob_CamelCase_HEADERS
HEADER_NAMES
ContactGroupExpandJob
ContactGroupSearchJob
ContactSearchJob
REQUIRED_HEADERS AkonadiContactJob_HEADERS
PREFIX Akonadi/Contact
RELATIVE job
)
ecm_generate_headers(AkonadiContact_CamelCase_HEADERS
HEADER_NAMES
AbstractContactFormatter
AbstractContactGroupFormatter
ContactDefaultActions
ContactEditor
ContactEditorDialog
ContactGroupEditor
ContactGroupEditorDialog
ContactGroupViewer
ContactGroupViewerDialog
ContactsFilterProxyModel
ContactsTreeModel
ContactParts
ContactViewer
ContactViewerDialog
EmailAddressSelection
EmailAddressSelectionDialog
EmailAddressSelectionWidget
EmailAddressSelectionModel
EmailAddressRequester
StandardContactActionManager
StandardContactFormatter
StandardContactGroupFormatter
SelectAddressBookDialog
REQUIRED_HEADERS AkonadiContact_HEADERS
PREFIX Akonadi/Contact
)
install( FILES
${AkonadiContact_CamelCase_HEADERS}
${AkonadiContactJob_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/Akonadi/Contact COMPONENT Devel
)
install( FILES
${AkonadiContact_HEADERS}
${AkonadiContactJob_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/akonadi-contact_export.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel
)
if (BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(tests)
endif()
add_subdirectory(plugins)
diff --git a/src/akonadi-contacts/actions/contactactionssettings.kcfg.cmake b/src/akonadi-contacts/actions/contactactionssettings.kcfg.cmake
index 64f3e3ca..0dbed7eb 100644
--- a/src/akonadi-contacts/actions/contactactionssettings.kcfg.cmake
+++ b/src/akonadi-contacts/actions/contactactionssettings.kcfg.cmake
@@ -1,103 +1,94 @@
Defines which application shall be used to show the postal address of a contact on a map. If 'Web Browser' is selected, an URL can be defined with placeholders for the single address parts. If 'External Application' is selected, a command with placeholders can be defined.UseOpenStreetMapThis URL defines the website that shall be used to show a contact's postal address.The following placeholders can be used in the URL:
%s: Street
%r: Region
%l: Location
%z: Zip Code
%c: Country ISO CodeThis command defines the application that shall be executed to show a contact's postal address.The following placeholders can be used in the command:
%s: Street
%r: Region
%l: Location
%z: Zip Code
%c: Country ISO Code
-
-
+
- Defines which application shall be used to dial the phone number of a contact. If 'Skype' is selected the Skype application will be started (if installed on the computer) and the number is dialed. If 'External Application' is selected, a command with placeholders can be defined.
- @AKONADI_PHONE_DIAL_DEFAULT@
+ Define how a phone number of a contact should be dialed. 'System Default' uses the default application configured for this on your system (e.g. KDE Connect). Selecting a specific application will use that (if installed), 'External Application' allows you to specify a dial command with placeholders manually.
+ UseSystemDefaultThis command defines the application that shall be executed to dial a contact's phone number.The following placeholders can be used in the command:
%N: The raw number as stored in the address book.
- %n: The normalized number with all non-digit characters removed.
-
-
-
- kdeconnect-cli --name 'phone name' --share 'tel:%N'
- The following placeholders can be used in the command:
- %N: The raw number as stored in the address book.
%n: The normalized number with all non-digit characters removed.
- Defines which application shall be used to send an SMS to the phone number of a contact. If 'Skype' is selected the Skype application will be started (if installed on the computer) and the SMS is sent via Skype. If 'External Application' is selected, a command with placeholders can be defined.@AKONADI_SEND_SMS_DEFAULT@This command defines the application that shall be executed to send an SMS to a contact's phone number.The following placeholders can be used in the command:
%N: The raw number as stored in the address book.
%n: The normalized number with all non-digit characters removed.
%t: The textkdeconnect-cli --name 'phone name' --destination %N --send-sms '%t'The following placeholders can be used in the command:
%N: The raw number as stored in the address book.
%n: The normalized number with all non-digit characters removed.
%t: The text
diff --git a/src/akonadi-contacts/actions/dialphonenumberaction.cpp b/src/akonadi-contacts/actions/dialphonenumberaction.cpp
index 7dedfd18..c8dcb670 100644
--- a/src/akonadi-contacts/actions/dialphonenumberaction.cpp
+++ b/src/akonadi-contacts/actions/dialphonenumberaction.cpp
@@ -1,89 +1,98 @@
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "dialphonenumberaction.h"
#include "contactactionssettings.h"
#include "qdialer.h"
#include "qsflphonedialer.h"
#include "qskypedialer.h"
#include "qekigadialer.h"
#include
#include
#include
#include
+#include
+
using namespace Akonadi;
static QString strippedDialNumber(const QString &number)
{
QString result;
const int numberLength(number.length());
for (int i = 0; i < numberLength; ++i) {
const QChar character = number.at(i);
if (character.isDigit() || (character == QLatin1Char('+') && i == 0)) {
result += character;
}
}
return result;
}
void DialPhoneNumberAction::dialNumber(const KContacts::PhoneNumber &number)
{
// synchronize
ContactActionsSettings::self()->load();
QDialer *dialer = nullptr;
// we handle skype separated
if (ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseSkype) {
dialer = new QSkypeDialer(QStringLiteral("AkonadiContacts"));
} else if (ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseSflPhone) {
dialer = new QSflPhoneDialer(QStringLiteral("AkonadiContacts"));
} else if (ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseEkiga) {
dialer = new QEkigaDialer(QStringLiteral("AkonadiContacts"));
}
if (dialer) {
if (!dialer->dialNumber(strippedDialNumber(number.number().trimmed()))) {
KMessageBox::sorry(nullptr, dialer->errorMessage());
}
delete dialer;
return;
}
- QString command = ContactActionsSettings::self()->phoneCommand();
+ if (ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseSystemDefault) {
+ QUrl url;
+ url.setScheme(QStringLiteral("tel"));
+ url.setPath(strippedDialNumber(number.number()));
+ QDesktopServices::openUrl(url);
+ return;
+ }
+ QString command = ContactActionsSettings::self()->phoneCommand();
if (command.isEmpty()) {
KMessageBox::sorry(nullptr, i18n("There is no application set which could be executed.\nPlease go to the settings dialog and configure one."));
return;
}
/*
* %N the raw number
* %n the number with all additional non-number characters removed
*/
command = command.replace(QLatin1String("%N"), number.number());
command = command.replace(QLatin1String("%n"), strippedDialNumber(number.number().trimmed()));
KRun::runCommand(command, nullptr);
}