diff --git a/dialer/CMakeLists.txt b/dialer/CMakeLists.txt index 0481b8f..c4a392e 100644 --- a/dialer/CMakeLists.txt +++ b/dialer/CMakeLists.txt @@ -1,8 +1,7 @@ kpackage_install_package(package org.kde.phone.dialer genericqml) install(FILES package/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.dialer.desktop) include_directories(${TELEPATHY_QT5_INCLUDE_DIR}) add_subdirectory(src) -add_subdirectory(plugin) diff --git a/dialer/package/contents/ui/Dialer/ContactsList.qml b/dialer/package/contents/ui/Dialer/ContactsList.qml index cf75fa1..0ae02b5 100644 --- a/dialer/package/contents/ui/Dialer/ContactsList.qml +++ b/dialer/package/contents/ui/Dialer/ContactsList.qml @@ -1,154 +1,153 @@ /* * Copyright 2015 Martin Klapetek * * This program 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 or * (at your option) any later version. * * This program 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 General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 2.2 as Controls import QtQuick.Layouts 1.1 import org.kde.kirigami 2.7 as Kirigami import org.kde.people 1.0 as KPeople import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.private.kpeoplehelper 1.0 Item { Controls.Label { anchors.centerIn: parent text: i18n("No contacts") - visible: contactsModel.count == 0 + visible: contactsModel.count === 0 } ColumnLayout { anchors.fill: parent //visible: contactsModel.count > 0 Kirigami.ActionTextField { id: searchField Layout.fillWidth: true placeholderText: i18n("Search...") rightActions: [ Kirigami.Action { icon.name: "edit-clear" onTriggered: searchField.text = "" - visible: searchField.text != "" + visible: searchField.text !== "" } ] } Controls.ScrollView { id: contactScrollView Layout.fillWidth: true Layout.fillHeight: true Controls.ScrollBar.vertical.policy: Controls.ScrollBar.AlwaysOn contentItem: ListView { id: contactsList property string numberToCall section.property: "display" section.criteria: ViewSection.FirstCharacter clip: true model: PlasmaCore.SortFilterModel { sourceModel: KPeople.PersonsSortFilterProxyModel { - sourceModel: KPeopleHelper { + sourceModel: KPeople.PersonsModel { id: contactsModel } requiredProperties: "phoneNumber" } sortRole: "display" filterRole: "display" filterRegExp: ".*" + searchField.text + ".*" sortOrder: Qt.AscendingOrder } // PlasmaCore.SortFilterModel { // sortRole: "display" // sourceModel: // } boundsBehavior: Flickable.StopAtBounds delegate: Kirigami.SwipeListItem { height: Kirigami.Units.gridUnit * 6 enabled: true clip: true onClicked: { contactsList.numberToCall = model.phoneNumber; } actions: [ Kirigami.Action { icon.name: "call-start" text: i18n("Call") onTriggered: call(contactsList.numberToCall) }, Kirigami.Action { icon.name: "configure-shortcuts" text: i18n("Send message") } ] RowLayout { id: mainLayout anchors.fill: parent spacing: 10 RoundImage { id: avatar source: model.decoration isRound: true Layout.preferredHeight: parent.height - Kirigami.Units.gridUnit Layout.preferredWidth: parent.height - Kirigami.Units.gridUnit } ColumnLayout { // contact name Kirigami.Heading { id: nickLabel text: model.display textFormat: Text.PlainText elide: Text.ElideRight maximumLineCount: 1 level: 3 Layout.fillWidth: true } Controls.Label { id: dataLabel text: model.phoneNumber elide: Text.ElideRight - visible: dataLabel.text != nickLabel.text + visible: dataLabel.text !== nickLabel.text } } } } CustomSectionScroller { listView: contactsList } } } } } diff --git a/dialer/plugin/CMakeLists.txt b/dialer/plugin/CMakeLists.txt deleted file mode 100644 index 4aefa7b..0000000 --- a/dialer/plugin/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(kpeoplehelper_SRCS - kpeoplehelper.cpp - kpeoplehelperplugin.cpp - ) - -add_library(kpeoplehelperplugin SHARED ${kpeoplehelper_SRCS}) -target_link_libraries(kpeoplehelperplugin Qt5::Core - Qt5::Qml - KF5::People - KF5::PeopleBackend) - -install(TARGETS kpeoplehelperplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/kpeoplehelper) - -install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/kpeoplehelper) diff --git a/dialer/plugin/kpeoplehelper.cpp b/dialer/plugin/kpeoplehelper.cpp deleted file mode 100644 index 1f39f97..0000000 --- a/dialer/plugin/kpeoplehelper.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "kpeoplehelper.h" - -#include -#include - -#include -#include - -KPeopleHelper::KPeopleHelper(QObject *parent) - : QIdentityProxyModel(parent) -{ - m_model = new KPeople::PersonsModel(this); - setSourceModel(m_model); -} - -KPeopleHelper::~KPeopleHelper() -{ - delete m_model; -} - -QVariant KPeopleHelper::data(const QModelIndex &index, int role) const -{ - if (!m_model) { - return QVariant(); - } - - if (role == KPeopleHelper::PhoneNumberRole) { - return m_model->contactCustomProperty(index, KPeople::AbstractContact::PhoneNumberProperty); - } - - return m_model->data(index, role); -} - -QHash KPeopleHelper::roleNames() const -{ - QHash roles = QAbstractItemModel::roleNames(); - roles.insert(PersonUriRole, "personUri"); - roles.insert(PersonVCardRole, "personVCard"); - roles.insert(ContactsVCardRole, "contactsVCard"); - roles.insert(PhoneNumberRole, "phoneNumber"); - return roles; -} diff --git a/dialer/plugin/kpeoplehelper.h b/dialer/plugin/kpeoplehelper.h deleted file mode 100644 index b902acc..0000000 --- a/dialer/plugin/kpeoplehelper.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef KPEOPLEHELPER_H -#define KPEOPLEHELPER_H - -#include -#include - -namespace KPeople { - class PersonsModel; -} - -class QAbstractItemModel; - -class KPeopleHelper : public QIdentityProxyModel -{ - Q_OBJECT - -public: - enum Role { - FormattedNameRole = Qt::DisplayRole,//QString best name for this person - PhotoRole = Qt::DecorationRole, //QPixmap best photo for this person - PersonUriRole = Qt::UserRole, //QString ID of this person - PersonVCardRole, //AbstractContact::Ptr - ContactsVCardRole, //AbstractContact::List (FIXME or map?) - - GroupsRole, ///groups QStringList - PhoneNumberRole, //QString - - UserRole = Qt::UserRole + 0x1000 ///< in case it's needed to extend, use this one to start from - }; - Q_ENUMS(Role) - - KPeopleHelper(QObject *parent = nullptr); - ~KPeopleHelper() override; - - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; - QHash roleNames() const Q_DECL_OVERRIDE; - -private: - KPeople::PersonsModel *m_model; -}; - -#endif // KPEOPLEHELPER_H diff --git a/dialer/plugin/kpeoplehelperplugin.cpp b/dialer/plugin/kpeoplehelperplugin.cpp deleted file mode 100644 index 3189c58..0000000 --- a/dialer/plugin/kpeoplehelperplugin.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "kpeoplehelperplugin.h" -#include "kpeoplehelper.h" - -#include - -void KPeopleHelperPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.kpeoplehelper")); - - qmlRegisterType(uri, 1, 0, "KPeopleHelper"); -} diff --git a/dialer/plugin/kpeoplehelperplugin.h b/dialer/plugin/kpeoplehelperplugin.h deleted file mode 100644 index 271cea4..0000000 --- a/dialer/plugin/kpeoplehelperplugin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - -#ifndef KPEOPLEHELPERPLUGIN_H -#define KPEOPLEHELPERPLUGIN_H - -#include - -class QQmlEngine; -class KPeopleHelperPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) override; - -}; - -#endif // KPEOPLEHELPERPLUGIN_H diff --git a/dialer/plugin/qmldir b/dialer/plugin/qmldir deleted file mode 100644 index 2d510a2..0000000 --- a/dialer/plugin/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module org.kde.plasma.private.kpeoplehelper -plugin kpeoplehelperplugin