diff --git a/src/contactview/contactview.qrc b/src/contactview/contactview.qrc index 6a889543..d1f13815 100644 --- a/src/contactview/contactview.qrc +++ b/src/contactview/contactview.qrc @@ -1,22 +1,23 @@ qml/pendingrequest.qml qml/contactlist.qml qml/bookmarklist.qml qml/contactcard.qml qml/bookmarkcard.qml qml/vcardform.qml qml/statistics.qml qml/newcontactdialog.qml qml/pendingrequests.qml qml/sendrequest.qml qml/viewcontactrequests.qml qml/contactinfo.qml qml/phonenumbers.qml qml/contactdialog.qml qml/addresses.qml + qml/commonactions.qml assets/welcome.html diff --git a/src/contactview/contactviewplugin.cpp b/src/contactview/contactviewplugin.cpp index f4be46ce..c5b48b56 100644 --- a/src/contactview/contactviewplugin.cpp +++ b/src/contactview/contactviewplugin.cpp @@ -1,59 +1,60 @@ /************************************************************************************ * Copyright (C) 2018 by BlueSystems GmbH * * Author : Emmanuel Lepage Vallee * * * * 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 "contactviewplugin.h" // Qt #include #include #include // QRC #include // CallView #include "contactphoto.h" void JamiContactView::registerTypes(const char *uri) { Q_ASSERT(uri == QByteArray("org.kde.ringkde.jamicontactview")); qmlRegisterType(uri, 1, 0, "ContactPhoto"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/pendingrequest.qml") , uri, 1, 0, "PendingRequest"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/contactlist.qml") , uri, 1, 0, "ContactList"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/bookmarklist.qml") , uri, 1, 0, "BookmarkList"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/contactcard.qml") , uri, 1, 0, "ContactCard"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/bookmarkcard.qml") , uri, 1, 0, "BookmarkCard"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/vcardform.qml") , uri, 1, 0, "VCardForm"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/statistics.qml") , uri, 1, 0, "Statistics"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/newcontactdialog.qml") , uri, 1, 0, "NewContactDialog"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/phonenumbers.qml") , uri, 1, 0, "PhoneNumbers"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/contactinfo.qml") , uri, 1, 0, "ContactInfo"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/pendingrequests.qml") , uri, 1, 0, "PendingRequests"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/sendrequest.qml") , uri, 1, 0, "SendRequest"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/viewcontactrequests.qml") , uri, 1, 0, "ViewContactRequests"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/addresses.qml") , uri, 1, 0, "Addresses"); qmlRegisterType(QStringLiteral("qrc:/contactview/qml/contactdialog.qml") , uri, 1, 0, "ContactDialog"); + qmlRegisterType(QStringLiteral("qrc:/contactview/qml/commonactions.qml") , uri, 1, 0, "CommonActions"); } void JamiContactView::initializeEngine(QQmlEngine *engine, const char *uri) { Q_UNUSED(engine) Q_UNUSED(uri) } diff --git a/views/basic/qml/actionswitch.qml b/src/contactview/qml/commonactions.qml similarity index 59% copy from views/basic/qml/actionswitch.qml copy to src/contactview/qml/commonactions.qml index 77e11387..cea7db55 100644 --- a/views/basic/qml/actionswitch.qml +++ b/src/contactview/qml/commonactions.qml @@ -1,61 +1,60 @@ /*************************************************************************** * Copyright (C) 2019 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.9 -import QtQuick.Controls 2.2 as Controls -import org.kde.kirigami 2.4 as Kirigami -import QtQuick.Layouts 1.2 as Layouts -Layouts.RowLayout { - property alias icon: icn.source - property alias text: txt.text - property alias checkable: swt.visible +import org.kde.ringkde.genericutils 1.0 as GenericUtils +import QtQuick.Layouts 1.2 as Layouts - Layouts.Layout.margins: 0 - Layouts.Layout.leftMargin: Kirigami.Units.smallSpacing - spacing: Kirigami.Units.smallSpacing +Layouts.ColumnLayout { + property QtObject individual: null - Layouts.Layout.preferredHeight: Math.max( - Kirigami.Units.fontMetrics.height, - Kirigami.Units.iconSizes.smallMedium - ) + Layouts.Layout.topMargin: 0 + Layouts.Layout.bottomMargin: 0 + Layouts.Layout.leftMargin: 0 + Layouts.Layout.rightMargin: 0 - Layouts.Layout.maximumHeight: Math.max( - Kirigami.Units.fontMetrics.height, - Kirigami.Units.iconSizes.smallMedium - ) + GenericUtils.ActionSwitch { + icon: "mail-message" + text: "Write email" + checkable: false + } - Layouts.Layout.fillWidth: true + GenericUtils.ActionSwitch { + icon: "delete" + text: "Delete contact" + checkable: false + } - Kirigami.Icon { - id: icn - source: "favorite" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium + GenericUtils.ActionSwitch { + icon: "edit-clear-history" + text: "Clear history" + checkable: false } - Controls.Label { - id: txt + GenericUtils.ActionSwitch { + icon: "favorite" text: "Bookmark" - color: "white" - Layouts.Layout.fillWidth: true + checkable: true } - Controls.Switch { - id: swt + GenericUtils.ActionSwitch { + icon: "im-kick-user" + text: "Block" + checkable: true } } diff --git a/src/contactview/qml/statistics.qml b/src/contactview/qml/statistics.qml index 7fe6e56b..49e1d43f 100644 --- a/src/contactview/qml/statistics.qml +++ b/src/contactview/qml/statistics.qml @@ -1,95 +1,112 @@ /*************************************************************************** - * Copyright (C) 2017 by Bluesystems * + * Copyright (C) 2017-2019 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.7 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.0 +import QtQuick.Controls 2.0 as Controls +import QtQuick.Layouts 1.0 as Layouts import org.kde.kirigami 2.2 as Kirigami -ColumnLayout { +Layouts.ColumnLayout { id: statistics property var individual: null property var labelColor: Kirigami.Theme.textColor - function getLastContacted() { - if (!individual) - return - - if (individual.lastUsedTime == 0) - return i18n("Never contacted") - - return i18n("Last contacted on: ") + individual.formattedLastUsedTime - } - - function getTotalCall() { - if (!individual) - return - - var label = i18n("Called: ") - - if (individual.totalSpentTime == 0) - return label + i18n("Never") - - return label + individual.callCount + - " time (" + (Math.floor(individual.totalSpentTime/60)) + " minutes)" - } - - function getTotalText() { - if (!individual) - return - - var label = i18n("Texted: ") - - if (individual.textMessageCount == 0) - return label + i18n("Never") - - return label + individual.textMessageCount - } - - Rectangle { - color: Kirigami.Theme.textColor - height: 1 - opacity: 0.3 - Layout.fillWidth: true + Layouts.Layout.topMargin: 0 + Layouts.Layout.bottomMargin: 0 + Layouts.Layout.leftMargin: 0 + Layouts.Layout.rightMargin: 0 + + Row { + Item {width: Kirigami.Units.smallSpacing; height: 1} + Kirigami.Icon { + source: "appointment-new" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium + } + Item {width: Kirigami.Units.smallSpacing; height: 1} + Controls.Label { + color:labelColor + text: mainPage.currentIndividual? + mainPage.currentIndividual.formattedLastUsedTime : "" + } + Layouts.Layout.fillWidth: true } - Label { - id: lastContactedTime - color: contactViewPage.labelColor ? contactViewPage.labelColor : Kirigami.Theme.textColor - text: individual ? getLastContacted() : "" + Row { + Item {width: Kirigami.Units.smallSpacing; height: 1} + Kirigami.Icon { + source: "dialog-messages" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium + } + Item {width: Kirigami.Units.smallSpacing; height: 1} + Controls.Label { + color:labelColor + text: "Texted "+ (mainPage.currentIndividual? + mainPage.currentIndividual.textMessageCount : 0) + " time" + } + Layouts.Layout.fillWidth: true } - Label { - id: totalCall - color: contactViewPage.labelColor ? contactViewPage.labelColor : Kirigami.Theme.textColor - text: individual ? getTotalCall() : "" + Row { + Item {width: Kirigami.Units.smallSpacing; height: 1} + Kirigami.Icon { + source: "dialog-messages" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium + } + Item {width: Kirigami.Units.smallSpacing; height: 1} + Controls.Label { + color:labelColor + text: (mainPage.currentIndividual? + mainPage.currentIndividual.unreadTextMessageCount : 0) + " unread messages" + } + Layouts.Layout.fillWidth: true } - Label { - id: totalText - color: contactViewPage.labelColor ? contactViewPage.labelColor : Kirigami.Theme.textColor - text: individual ? getTotalText() : "" + Row { + Item {width: Kirigami.Units.smallSpacing; height: 1} + Kirigami.Icon { + source: "call-start" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium + } + Item {width: Kirigami.Units.smallSpacing; height: 1} + Controls.Label { + color:labelColor + text: "Called "+ (mainPage.currentIndividual? + mainPage.currentIndividual.callCount : 0) + " time" + } + Layouts.Layout.fillWidth: true } - Rectangle { - color: contactViewPage.state == "mobile" ? "transparent" : Kirigami.Theme.textColor - opacity: 0.3 - height: 1 - Layout.fillWidth: true - Layout.fillHeight: contactViewPage.state == "mobile" + Row { + Item {width: Kirigami.Units.smallSpacing; height: 1} + Kirigami.Icon { + source: "call-start" + height: Kirigami.Units.iconSizes.smallMedium + width: Kirigami.Units.iconSizes.smallMedium + } + Item {width: Kirigami.Units.smallSpacing; height: 1} + Controls.Label { + color:labelColor + text: "Spoken "+ Math.ceil((mainPage.currentIndividual? + mainPage.currentIndividual.totalSpentTime : 0)/60) + " minutes" + } + Layouts.Layout.fillWidth: true } } diff --git a/src/genericutils/plugin.cpp b/src/genericutils/plugin.cpp index 7b21db94..526436dc 100644 --- a/src/genericutils/plugin.cpp +++ b/src/genericutils/plugin.cpp @@ -1,49 +1,50 @@ /*************************************************************************** * Copyright (C) 2017 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ #include "plugin.h" #include #include #include #include "treehelper.h" #include "symboliccolorizer.h" #include "fileloader.h" #include "qrc_qmlwidgets.cpp" void GenericUtils::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.ringkde.genericutils")); qmlRegisterType(uri, 1, 0, "QAction"); qmlRegisterType(uri, 1, 0, "TreeHelper"); qmlRegisterType(uri, 1, 0, "FileLoader"); qmlRegisterType(QStringLiteral("qrc:/qml/outlinebutton.qml"), uri, 1, 0, "OutlineButton"); qmlRegisterType(QStringLiteral("qrc:/qml/outlinebuttons.qml"), uri, 1, 0, "OutlineButtons"); + qmlRegisterType(QStringLiteral("qrc:/qml/actionswitch.qml"), uri, 1, 0, "ActionSwitch"); } void GenericUtils::initializeEngine(QQmlEngine *engine, const char *uri) { Q_UNUSED(engine) Q_UNUSED(uri) static SymbolicColorizer p; engine->addImageProvider( QStringLiteral("SymbolicColorizer"), &p); } diff --git a/views/basic/qml/actionswitch.qml b/src/genericutils/qml/actionswitch.qml similarity index 100% copy from views/basic/qml/actionswitch.qml copy to src/genericutils/qml/actionswitch.qml diff --git a/src/genericutils/qmlwidgets.qrc b/src/genericutils/qmlwidgets.qrc index a1d987f2..db0d992a 100644 --- a/src/genericutils/qmlwidgets.qrc +++ b/src/genericutils/qmlwidgets.qrc @@ -1,6 +1,7 @@ qml/outlinebutton.qml qml/outlinebuttons.qml + qml/actionswitch.qml diff --git a/src/jaminotification/CMakeLists.txt b/src/jaminotification/CMakeLists.txt index b212aa3d..b8634f0d 100644 --- a/src/jaminotification/CMakeLists.txt +++ b/src/jaminotification/CMakeLists.txt @@ -1,134 +1,138 @@ cmake_minimum_required(VERSION 3.0) project(jaminotification) if(POLICY CMP0063) CMAKE_POLICY(SET CMP0063 NEW) endif(POLICY CMP0063) find_package(ECM 1.1.0 REQUIRED NO_MODULE) list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") include(ECMInstallIcons) include(ECMOptionalAddSubdirectory) include(CMakePackageConfigHelpers) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) SET(CMAKE_C_VISIBILITY_PRESET hidden) SET(CMAKE_CXX_VISIBILITY_PRESET hidden) SET(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # When used with `add_subdirectory`, assume it is a static Qt plugin get_directory_property(USES_ADD_SUBDIRECTORY PARENT_DIRECTORY) if(USES_ADD_SUBDIRECTORY) set(BUILD_SHARED_LIBS OFF) endif() set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 14) if(NOT BUILD_SHARED_LIBS) set(ENABLE_STATIC_PLUGIN 1) # Used in Config.cmake.in add_definitions(-DQT_PLUGIN) add_definitions(-DQT_STATICPLUGIN=1) add_definitions(-DJAMINOTIFICATION_USE_STATIC_PLUGIN=1) endif() find_package(Qt5 CONFIG REQUIRED Core Gui Quick QuickControls2 ) if(X11_FOUND) find_package(Qt5 QUIET OPTIONAL_COMPONENTS Qt5::X11Extras) endif() set(GENERIC_LIB_VERSION "1.0.0") #File to compile set( jaminotification_LIB_SRCS plugin.cpp notification.cpp focuslistener.cpp ) +qt5_add_resources(jaminotification_LIB_SRCS + jaminotification.qrc +) + set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.ringkde.jaminotification) include_directories(SYSTEM ${ringqt_INCLUDE_DIR}) add_library(jaminotification ${jaminotification_LIB_SRCS} ) target_link_libraries( jaminotification # Project ringqt ringqtquick # Qt Qt5::Core Qt5::Gui Qt5::Quick Qt5::QuickControls2 # KF5 KF5::Notifications KF5::I18n ) if(X11_FOUND) target_link_libraries( jaminotification Qt5::X11Extras ${X11_X11_LIB} ) endif() # Configure the target config set(jaminotification_CONFIG_PATH "${CMAKE_CURRENT_BINARY_DIR}/JamiNotificationConfig.cmake") if(USES_ADD_SUBDIRECTORY) set(JamiNotification_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) endif() configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/JamiNotificationConfig.cmake.in" ${jaminotification_CONFIG_PATH} INSTALL_DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiNotification/ PATH_VARS INCLUDE_INSTALL_DIR ) install( FILES ${jaminotification_CONFIG_PATH} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiNotification/ COMPONENT Devel ) # Create the target target_include_directories(jaminotification PUBLIC $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ ) set_target_properties(jaminotification PROPERTIES PUBLIC_HEADER "${jaminotification_EXPORT_HDRS}" ) export(TARGETS jaminotification FILE "${PROJECT_BINARY_DIR}/cmake/JamiNotificationTargets.cmake" ) install(TARGETS jaminotification EXPORT JamiNotificationTargets LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" COMPONENT jaminotification ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT Devel ) install(EXPORT JamiNotificationTargets DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiNotification COMPONENT Devel ) diff --git a/src/jaminotification/jaminotification.qrc b/src/jaminotification/jaminotification.qrc new file mode 100644 index 00000000..45a3c2b9 --- /dev/null +++ b/src/jaminotification/jaminotification.qrc @@ -0,0 +1,5 @@ + + + qml/individualsettings.qml + + diff --git a/src/jaminotification/plugin.cpp b/src/jaminotification/plugin.cpp index 886508c9..a99eac8d 100644 --- a/src/jaminotification/plugin.cpp +++ b/src/jaminotification/plugin.cpp @@ -1,43 +1,47 @@ /************************************************************************************ * Copyright (C) 2018 by BlueSystems GmbH * * Author : Emmanuel Lepage Vallee * * * * 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 "plugin.h" // Qt #include #include #include // Ring-KDE #include "focuslistener.h" #include "notification.h" +#include + void JamiNotification::registerTypes(const char *uri) { Q_ASSERT(uri == QByteArray("org.kde.ringkde.jaminotification")); qmlRegisterType(uri, 1, 0, "FocusListener"); + + qmlRegisterType(QStringLiteral("qrc:/jaminotification/qml/individualsettings.qml"), uri, 1, 0, "IndividualSettings"); } void JamiNotification::initializeEngine(QQmlEngine *engine, const char *uri) { Q_ASSERT(uri == QByteArray("org.kde.ringkde.jaminotification")); Q_UNUSED(engine) Notification::instance(); } diff --git a/views/basic/qml/actionswitch.qml b/src/jaminotification/qml/individualsettings.qml similarity index 60% rename from views/basic/qml/actionswitch.qml rename to src/jaminotification/qml/individualsettings.qml index 77e11387..13e4829a 100644 --- a/views/basic/qml/actionswitch.qml +++ b/src/jaminotification/qml/individualsettings.qml @@ -1,61 +1,48 @@ /*************************************************************************** * Copyright (C) 2019 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.9 -import QtQuick.Controls 2.2 as Controls -import org.kde.kirigami 2.4 as Kirigami -import QtQuick.Layouts 1.2 as Layouts - -Layouts.RowLayout { - property alias icon: icn.source - property alias text: txt.text - property alias checkable: swt.visible - - Layouts.Layout.margins: 0 - Layouts.Layout.leftMargin: Kirigami.Units.smallSpacing - spacing: Kirigami.Units.smallSpacing - Layouts.Layout.preferredHeight: Math.max( - Kirigami.Units.fontMetrics.height, - Kirigami.Units.iconSizes.smallMedium - ) +import org.kde.ringkde.genericutils 1.0 as GenericUtils +import QtQuick.Layouts 1.2 as Layouts - Layouts.Layout.maximumHeight: Math.max( - Kirigami.Units.fontMetrics.height, - Kirigami.Units.iconSizes.smallMedium - ) +Layouts.ColumnLayout { + property QtObject individual: null - Layouts.Layout.fillWidth: true + Layouts.Layout.topMargin: 0 + Layouts.Layout.bottomMargin: 0 + Layouts.Layout.leftMargin: 0 + Layouts.Layout.rightMargin: 0 - Kirigami.Icon { - id: icn - source: "favorite" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium + GenericUtils.ActionSwitch { + Layouts.Layout.fillWidth: true + icon: "preferences-desktop-notification" + text: "On new messages" } - Controls.Label { - id: txt - text: "Bookmark" - color: "white" + GenericUtils.ActionSwitch { Layouts.Layout.fillWidth: true + icon: "preferences-desktop-notification" + text: "On presence changes" } - Controls.Switch { - id: swt + GenericUtils.ActionSwitch { + Layouts.Layout.fillWidth: true + icon: "preferences-desktop-notification" + text: "Ignore incoming calls" } } diff --git a/views/basic/basic.qrc b/views/basic/basic.qrc index b9c2f1da..567630d0 100644 --- a/views/basic/basic.qrc +++ b/views/basic/basic.qrc @@ -1,18 +1,17 @@ qml/actioncollection.qml qml/basic.qml qml/chatpage.qml qml/contacts.qml qml/desktopheader.qml qml/detailpage.qml qml/detail.qml qml/formpage.qml qml/listpage.qml qml/list.qml qml/globaldrawer.qml qml/sidebar.qml - qml/actionswitch.qml qml/callpage.qml diff --git a/views/basic/basicviewplugin.cpp b/views/basic/basicviewplugin.cpp index 28c78b06..d87e901d 100644 --- a/views/basic/basicviewplugin.cpp +++ b/views/basic/basicviewplugin.cpp @@ -1,47 +1,46 @@ /*************************************************************************** * Copyright (C) 2017 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ #include "basicviewplugin.h" #include #include #include void BasicView::registerTypes(const char *uri) { qmlRegisterType(QStringLiteral("qrc:/basicview/qml/actioncollection.qml"), uri, 1, 0, "ActionCollection"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/chatpage.qml"), uri, 1, 0, "ChatPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/callpage.qml"), uri, 1, 0, "CallPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/contacts.qml"), uri, 1, 0, "Contacts"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/desktopheader.qml"), uri, 1, 0, "DesktopHeader"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/detailpage.qml"), uri, 1, 0, "DetailPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/detail.qml"), uri, 1, 0, "Detail"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/formpage.qml"), uri, 1, 0, "FormPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/listpage.qml"), uri, 1, 0, "ListPage"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/list.qml"), uri, 1, 0, "List"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/globaldrawer.qml"), uri, 1, 0, "GlobalDrawer"); qmlRegisterType(QStringLiteral("qrc:/basicview/qml/sidebar.qml"), uri, 1, 0, "SideBar"); - qmlRegisterType(QStringLiteral("qrc:/basicview/qml/actionswitch.qml"), uri, 1, 0, "ActionSwitch"); } void BasicView::initializeEngine(QQmlEngine* engine, const char* uri) { Q_UNUSED(engine) Q_UNUSED(uri) } diff --git a/views/basic/qml/sidebar.qml b/views/basic/qml/sidebar.qml index 8e83af8c..4c08cb77 100644 --- a/views/basic/qml/sidebar.qml +++ b/views/basic/qml/sidebar.qml @@ -1,228 +1,126 @@ /*************************************************************************** * Copyright (C) 2019 by Bluesystems * * Author : Emmanuel Lepage Vallee * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 3 of the License, 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 General Public License * * along with this program. If not, see . * **************************************************************************/ import QtQuick 2.9 import QtQuick.Controls 2.2 as Controls import org.kde.kirigami 2.4 as Kirigami import QtQuick.Layouts 1.2 as Layouts import org.kde.ringkde.basicview 1.0 as BasicView import org.kde.ringkde.jamicontactview 1.0 as JamiContactView +import org.kde.ringkde.jaminotification 1.0 as JamiNotification +import org.kde.ringkde.genericutils 1.0 as GenericUtils Controls.ToolBar { id: sideBar property QtObject individual: mainPage.currentIndividual Layouts.ColumnLayout { anchors.fill: parent spacing: Kirigami.Units.largeSpacing*2 BasicView.DesktopHeader { Layouts.Layout.preferredWidth: parent.width Layouts.Layout.preferredHeight: Kirigami.Units.iconSizes.large*1.5 textColor: "white" photoSize: Kirigami.Units.iconSizes.large*1.5 } Kirigami.Separator { Layouts.Layout.fillWidth: true color: "white" } Controls.TabBar { Layouts.Layout.fillWidth: true Controls.TabButton { text: "Foo" } Controls.TabButton { text: "Bar" } Controls.TabButton { text: "Baz" } } Kirigami.Heading { level: 1 text: "Actions" color: "white" Layouts.Layout.fillWidth: true elide: Text.ElideRight //show only when at least half of the string has been painted: use //opacity as using visible it won't correctly recalculate the width opacity: width > implicitWidth/2 } - BasicView.ActionSwitch { - icon: "mail-message" - text: "Write email" - checkable: false - } - - BasicView.ActionSwitch { - icon: "delete" - text: "Delete contact" - checkable: false - } - - BasicView.ActionSwitch { - icon: "edit-clear-history" - text: "Clear history" - checkable: false - } - - BasicView.ActionSwitch { - icon: "favorite" - text: "Bookmark" - checkable: true - } - - BasicView.ActionSwitch { - icon: "im-kick-user" - text: "Block" - checkable: true + JamiContactView.CommonActions { + individual: mainPage.individual + Layouts.Layout.fillWidth: true } Kirigami.Heading { level: 1 text: "Notifications" color: "white" Layouts.Layout.fillWidth: true elide: Text.ElideRight //show only when at least half of the string has been painted: use //opacity as using visible it won't correctly recalculate the width opacity: width > implicitWidth/2 } - BasicView.ActionSwitch { - icon: "preferences-desktop-notification" - text: "On new messages" - } - - BasicView.ActionSwitch { - icon: "preferences-desktop-notification" - text: "On presence changes" - } - - BasicView.ActionSwitch { - icon: "preferences-desktop-notification" - text: "Ignore incoming calls" + JamiNotification.IndividualSettings { + individual: mainPage.individual + Layouts.Layout.fillWidth: true } Kirigami.Heading { level: 1 text: "Statistics" color: "white" Layouts.Layout.fillWidth: true elide: Text.ElideRight //show only when at least half of the string has been painted: use //opacity as using visible it won't correctly recalculate the width opacity: width > implicitWidth/2 } - Row { - Item {width: Kirigami.Units.smallSpacing; height: 1} - Kirigami.Icon { - source: "appointment-new" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium - } - Item {width: Kirigami.Units.smallSpacing; height: 1} - Controls.Label { - color: "white"; text: mainPage.currentIndividual? - mainPage.currentIndividual.formattedLastUsedTime : "" - } - Layouts.Layout.fillWidth: true - } - - Row { - Item {width: Kirigami.Units.smallSpacing; height: 1} - Kirigami.Icon { - source: "dialog-messages" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium - } - Item {width: Kirigami.Units.smallSpacing; height: 1} - Controls.Label { - color: "white"; text: "Texted "+ (mainPage.currentIndividual? - mainPage.currentIndividual.textMessageCount : 0) + " time" - } - Layouts.Layout.fillWidth: true - } - - Row { - Item {width: Kirigami.Units.smallSpacing; height: 1} - Kirigami.Icon { - source: "dialog-messages" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium - } - Item {width: Kirigami.Units.smallSpacing; height: 1} - Controls.Label { - color: "white"; text: (mainPage.currentIndividual? - mainPage.currentIndividual.unreadTextMessageCount : 0) + " unread messages" - } - Layouts.Layout.fillWidth: true - } - - Row { - Item {width: Kirigami.Units.smallSpacing; height: 1} - Kirigami.Icon { - source: "call-start" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium - } - Item {width: Kirigami.Units.smallSpacing; height: 1} - Controls.Label { - color: "white"; text: "Called "+ (mainPage.currentIndividual? - mainPage.currentIndividual.callCount : 0) + " time" - } - Layouts.Layout.fillWidth: true - } - - Row { - Item {width: Kirigami.Units.smallSpacing; height: 1} - Kirigami.Icon { - source: "call-start" - height: Kirigami.Units.iconSizes.smallMedium - width: Kirigami.Units.iconSizes.smallMedium - } - Item {width: Kirigami.Units.smallSpacing; height: 1} - Controls.Label { - color: "white"; text: "Spoken "+ Math.ceil((mainPage.currentIndividual? - mainPage.currentIndividual.totalSpentTime : 0)/60) + " minutes" - } + JamiContactView.Statistics { + individual: mainPage.individual Layouts.Layout.fillWidth: true + labelColor: Kirigami.Theme.textColor } Item { Layouts.Layout.fillHeight: true } } }