diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a88630c..1a19d4bc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,363 +1,334 @@ IF(POLICY CMP0017) CMAKE_POLICY(SET CMP0017 NEW) ENDIF(POLICY CMP0017) IF(POLICY CMP0022) CMAKE_POLICY(SET CMP0022 NEW) ENDIF(POLICY CMP0022) IF(POLICY CMP0063) CMAKE_POLICY(SET CMP0063 NEW) ENDIF(POLICY CMP0063) SET(QT_MIN_VERSION "5.2.0") ADD_DEFINITIONS( ${KF5_DEFINITIONS} ${QT_DEFINITIONS} -fexceptions -Wno-error -Wno-reorder -Wno-error=deprecated-declarations ) # It doesn't work in sandboxes IF (NOT ENABLE_SINGLE_INSTANCE) ADD_DEFINITIONS(-DDISABLE_KDBUS_SERVICE=1) ENDIF() # Enable some useful warnings ADD_DEFINITIONS( -Wall -Wextra -Wmissing-declarations -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wswitch-enum -Winit-self -Wmissing-include-dirs -Wundef -Wmissing-format-attribute -Wno-reorder -Wunused -Wuninitialized -Woverloaded-virtual -Wunused-value -pedantic -Wnonnull -Wsequence-point #-Wsystem-headers -Wsizeof-pointer-memaccess #-Wuseless-cast -Wvarargs ) #Add more warnings for compilers that support it. I used this command: #curl https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Warning-Options.html | \ #grep -E "^[\t ]+
-W[a-zA-Z=-]*" -o | grep -E "\-W[a-zA-Z=-]*" -o > #cat /tmp/48 /tmp/49 | sort | uniq -u # IF (CMAKE_COMPILER_IS_GNUCC) IF (CMAKE_COMPILER_IS_GNUCC) IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9) ADD_DEFINITIONS( -Wunused-but-set-parameter -Wconditionally-supported -Wno-cpp # -Wdouble-promotion -Wdate-time -Wdelete-incomplete # -Wfloat-conversion ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9) ADD_DEFINITIONS( -Wno-pragmas ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.0) ADD_DEFINITIONS( -Wsuggest-override -Wsuggest-final-types -Wsuggest-final-methods -Wbool-compare -Wformat-signedness -Wlogical-not-parentheses -Wnormalized -Wshift-count-negative -Wshift-count-overflow -Wsized-deallocation -Wsizeof-array-argument ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 6.0) ADD_DEFINITIONS( -Wnull-dereference -Wtautological-compare -Wduplicated-cond -Wmisleading-indentation ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0) ADD_DEFINITIONS( -Wimplicit-fallthrough -Wduplicated-branches -Wswitch-unreachable -Wformat-overflow -Wformat-truncation -Wnonnull ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0) ADD_DEFINITIONS( -Wmultistatement-macros -Wstringop-truncation -Wif-not-aligned -Wmissing-attributes ) ENDIF() ENDIF() IF (CMAKE_COMPILER_IS_GNUCC) EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION) IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.6) #GCC 4.6 version of those warnings does detect valid C++0x/C++11 as invalid. ADD_DEFINITIONS( -Wno-error=pragmas -Wno-pragmas -Wno-error ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.7) ADD_DEFINITIONS( -Wmaybe-uninitialized -Wunused-local-typedefs -pedantic ) ENDIF() IF (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.8) # ADD_DEFINITIONS("-Wzero-as-null-pointer-constant") # ADD_DEFINITIONS( -DENABLE_IGNORE_NULL=true ) ENDIF() ELSE() ADD_DEFINITIONS(-Wno-unknown-pragmas -Wno-unknown-warning-option) ENDIF() ADD_DEFINITIONS("-std=c++0x") #Make sure it can access DBUS autogenerated files INCLUDE_DIRECTORIES(SYSTEM ${KF5_INCLUDES} ${Qt5Widgets_INCLUDES} ${Qt5PrintSupport_INCLUDES} ${Qt5Core_INCLUDES} ${CMAKE_BINARY_DIR} ${ringqt_INCLUDE_DIR} ${LIB_TIP_INCLUDE} ${LIB_CONFIG_INCLUDE} ${LIB_CONFIG_WIDGETS} ) # Shared C++ QML components ADD_SUBDIRECTORY( qmlwidgets ) -# Pack the icons shared by various components -ADD_SUBDIRECTORY( sharedassets ) - #Build KDE specific files -ADD_SUBDIRECTORY( klib ) +ADD_SUBDIRECTORY( jamikdeintegration ) # Build the QML based first run Wizard ADD_SUBDIRECTORY( wizard ) # Build the QML based interactive video canvas ADD_SUBDIRECTORY( callview ) # Build the advanced phone dialer ADD_SUBDIRECTORY( dialview ) # Build the views and widgets related to the social timeline feature ADD_SUBDIRECTORY( timeline ) # Build the contact and profile photo editor dialog ADD_SUBDIRECTORY( photoselector ) # Build the elements used to notify the users of events ADD_SUBDIRECTORY( canvasindicators ) # Build the contact manager subsystem ADD_SUBDIRECTORY( contactview ) # Build the account manager subsystem ADD_SUBDIRECTORY( accountview ) # Build the main desktop component ADD_SUBDIRECTORY( desktopview ) +# ADD_DEPENDENCIES(desktopview DEPENDS jamikdeintegration) + IF(${CMAKE_BUILD_TYPE} MATCHES Release) MESSAGE("NO DEBUG OUTPUT") ADD_DEFINITIONS( -DQT_NO_DEBUG_OUTPUT) ELSE() ENDIF(${CMAKE_BUILD_TYPE} MATCHES Release) -# Delegates -SET( - ring_kde_PROXIES - delegates/kdepixmapmanipulation.cpp - proxies/simplerotateproxy.cpp - proxies/deduplicateproxy.cpp - proxies/filtertoplevelproxy.cpp - proxies/roletransformationproxy.cpp - proxies/flagsfilterproxy.cpp - proxies/pollingproxy.cpp -) - SET( ring_kde_SRCS main.cpp cmd.cpp - notification.cpp ringapplication.cpp errormessage.cpp - actioncollection.cpp - implementation.cpp - model/extendedprotocolmodel.cpp - ${ring_kde_PROXIES} - widgets/systray.cpp ) - -IF (Qt5TextToSpeech_FOUND) - -SET( - ring_kde_SRCS - ${ring_kde_SRCS} - accessibility.cpp -) -ENDIF() - # generate rules for building source files from the resources SET(QtApp_RCCS qrc/resources.qrc # conf/confresources.qrc ../data/appicon.qrc ) QT5_ADD_RESOURCES(QtApp_RCC_SRCS ${QtApp_RCCS}) # add_subdirectory( test ) #Enable again some day, it cause compile problems for some users IF(NOT (${ENABLE_VIDEO} MATCHES false)) SET(ENABLE_VIDEO 1 CACHE BOOLEAN "Enable video") ADD_DEFINITIONS( -DENABLE_VIDEO=true ) SET ( config_ui_files ${config_ui_files} conf/dlgvideobase.ui ) ENDIF(NOT (${ENABLE_VIDEO} MATCHES false)) IF(${DISABLE_UNIQUE_APPLICATION} MATCHES true) MESSAGE("KUniqueApplication disabled") SET(DISABLE_UNIQUE_APPLICATION 1 CACHE BOOLEAN "Disable KUniqueApplication") ADD_DEFINITIONS( -DDISABLE_UNIQUE_APPLICATION=true ) ENDIF(${DISABLE_UNIQUE_APPLICATION} MATCHES true) ki18n_wrap_ui(ring_kde_SRCS ${config_ui_files} ) IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ADD_EXECUTABLE(ring-kde MACOSX_BUNDLE ${ring_kde_SRCS} ${QtApp_RCC_SRCS}) set_source_files_properties( ../data/ring-kdeui.rc PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) file( COPY ../data/ring-kdeui.rc DESTINATION "ring-kde.app/Contents/Resources/" ) ELSE() ADD_EXECUTABLE(ring-kde ${ring_kde_SRCS} ${QtApp_RCC_SRCS}) ENDIF() IF(NOT ${ENABLE_STATIC} MATCHES false) FIND_PACKAGE(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED DBus) INCLUDE_DIRECTORIES(SYSTEM ${Qt5DBus_INCLUDE_DIRS} ) LINK_DIRECTORIES(${Qt5DBus_LIBRARY_DIRS} ) ADD_DEFINITIONS(${Qt5DBus_CFLAGS}) IF(NOT DEFINED OS_ANDROID) TARGET_LINK_LIBRARIES(ring-kde -lpthread ) ENDIF() TARGET_LINK_LIBRARIES(ring-kde ${ringqt_LIBRARY_STATIC} ) IF(NOT ${ENABLE_LIBWRAP}) TARGET_LINK_LIBRARIES(ring-kde ${Qt5DBus_LIBRARIES} ) ENDIF() ELSE() TARGET_LINK_LIBRARIES(ring-kde ${ringqt_LIBRARY_DYNAMIC}) ENDIF() QT5_ADD_DBUS_ADAPTOR(ring_kde_SRCS ../data/org.kde.kuiserver.xml cmd.h Cmd ) TARGET_LINK_LIBRARIES(ring-kde - libkring - libwizard + jamiwizard libcallview dialview libtimeline libphotoselector libcanvasindicator desktopview contactview - accountview + jamiaccountview libqmlwidgets kquickitemviews + jamikdeintegration # RingQt ringqtquick # Qt5 Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Svg Qt5::PrintSupport # KF5 KF5::I18n KF5::WidgetsAddons KF5::ConfigCore KF5::ConfigGui KF5::DBusAddons KF5::XmlGui KF5::Notifications KF5::IconThemes KF5::Crash KF5::NotifyConfig KF5::GlobalAccel KF5::Declarative KF5::Kirigami2 ) IF (Qt5TextToSpeech_FOUND) TARGET_LINK_LIBRARIES(ring-kde Qt5::TextToSpeech ) ENDIF() ########### install files ############### INSTALL( TARGETS ring-kde DESTINATION ${BIN_INSTALL_DIR} ) INSTALL( FILES wizard/assets/beta_logo.svg DESTINATION ${DATA_INSTALL_DIR}/ring-kde ) diff --git a/src/accountview/CMakeLists.txt b/src/accountview/CMakeLists.txt index 4dedc6ee..ef90d01a 100644 --- a/src/accountview/CMakeLists.txt +++ b/src/accountview/CMakeLists.txt @@ -1,30 +1,119 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.5) +cmake_minimum_required(VERSION 3.0) -ADD_DEFINITIONS("-std=c++11") +project(jamiaccountview) -PROJECT(accountview) +if(POLICY CMP0063) + CMAKE_POLICY(SET CMP0063 NEW) +endif(POLICY CMP0063) -SET(CMAKE_AUTOMOC ON) -SET(CMAKE_AUTORCC ON) -SET(CMAKE_AUTOUIC ON) +find_package(ECM 1.1.0 REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") -SET(GENERIC_LIB_VERSION "1.0.0") +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(-DJAMIACCOUNTVIEW_USE_STATIC_PLUGIN=1) +endif() + +find_package(Qt5 CONFIG REQUIRED + Core Gui Quick QuickControls2 +) + +set(GENERIC_LIB_VERSION "1.0.0") #File to compile -SET( accountview_LIB_SRCS - accountviewplugin.cpp +set( jamiaccountview_LIB_SRCS + accountviewplugin.cpp ) -QT5_ADD_RESOURCES(accountview_LIB_SRCS - accountview.qrc +qt5_add_resources(jamiaccountview_LIB_SRCS + accountview.qrc ) -ADD_LIBRARY( accountview STATIC ${accountview_LIB_SRCS} ) +set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.ringkde.jamiaccountview) + +add_library(jamiaccountview ${jamiaccountview_LIB_SRCS} ) + +target_link_libraries( jamiaccountview + # Project + ringqt + ringqtquick -target_link_libraries( accountview + # Qt Qt5::Core Qt5::Gui Qt5::Quick Qt5::QuickControls2 - KF5::ConfigWidgets +) + +# Configure the target config +set(jamiaccountview_CONFIG_PATH "${CMAKE_CURRENT_BINARY_DIR}/JamiAccountViewConfig.cmake") + +if(USES_ADD_SUBDIRECTORY) + set(JamiAccountView_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) +endif() + +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/JamiAccountViewConfig.cmake.in" ${jamiaccountview_CONFIG_PATH} + INSTALL_DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiAccountView/ + PATH_VARS INCLUDE_INSTALL_DIR +) + +install( FILES ${jamiaccountview_CONFIG_PATH} + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiAccountView/ + COMPONENT Devel +) + +# Create the target +target_include_directories(jamiaccountview + PUBLIC + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/ +) + +set_target_properties(jamiaccountview PROPERTIES + PUBLIC_HEADER + "${jamiaccountview_EXPORT_HDRS}" +) + +export(TARGETS jamiaccountview + FILE "${PROJECT_BINARY_DIR}/cmake/JamiAccountViewTargets.cmake" +) + +install(TARGETS jamiaccountview + EXPORT JamiAccountViewTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" COMPONENT jamiaccountview + ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + COMPONENT Devel +) + +install(EXPORT JamiAccountViewTargets + DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/JamiAccountView + COMPONENT Devel ) diff --git a/src/accountview/accountviewplugin.cpp b/src/accountview/accountviewplugin.cpp index e16dad5f..5f2358a8 100644 --- a/src/accountview/accountviewplugin.cpp +++ b/src/accountview/accountviewplugin.cpp @@ -1,26 +1,27 @@ /*************************************************************************** * 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 "accountviewplugin.h" #include #include -void AccountView::registerTypes(const char *) +void JamiAccountView::registerTypes(const char *) { + } diff --git a/src/accountview/accountviewplugin.h b/src/accountview/accountviewplugin.h index d635dd91..0e44da8d 100644 --- a/src/accountview/accountviewplugin.h +++ b/src/accountview/accountviewplugin.h @@ -1,30 +1,29 @@ /*************************************************************************** * Copyright (C) 2018 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 . * **************************************************************************/ #pragma once -#include +#include -//![plugin] -class AccountView final : public QObject +class Q_DECL_EXPORT JamiAccountView final : public QQmlExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.ringkde.jamiaccountview" FILE "jamiaccountview.json") public: - void registerTypes(const char *uri); + void registerTypes(const char* uri) override; }; -//![plugin] diff --git a/src/accountview/cmake/JamiAccountViewConfig.cmake.in b/src/accountview/cmake/JamiAccountViewConfig.cmake.in new file mode 100644 index 00000000..581e940a --- /dev/null +++ b/src/accountview/cmake/JamiAccountViewConfig.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ + +#Allow users to when to use Q_IMPORT_PLUGIN in main.cpp +if(@ENABLE_STATIC_PLUGIN@ MATCHES 1) + add_definitions(-DJAMIWIZARD_USE_STATIC_PLUGIN=1) +endif() + +include("${CMAKE_CURRENT_LIST_DIR}/JamiAccountViewTargets.cmake") diff --git a/src/accountview/jamiaccountview.json b/src/accountview/jamiaccountview.json new file mode 100644 index 00000000..b20c6efa --- /dev/null +++ b/src/accountview/jamiaccountview.json @@ -0,0 +1,4 @@ +{ + "Keys": [ "org.kde.ringkde.jamiaccountview" ], + "uri": ["org.kde.ringkde.jamiaccountview"] +} diff --git a/src/accountview/qml/accountlist.qml b/src/accountview/qml/accountlist.qml index 9d3badbe..15e1da38 100644 --- a/src/accountview/qml/accountlist.qml +++ b/src/accountview/qml/accountlist.qml @@ -1,297 +1,297 @@ /*************************************************************************** * Copyright (C) 2018 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.Layouts 1.0 import RingQmlWidgets 1.0 import Ring 1.0 import QtQuick.Controls 2.2 import ContactView 1.0 import org.kde.kirigami 2.2 as Kirigami import org.kde.playground.kquickitemviews 1.0 as KQuickItemViews import net.lvindustries.ringqtquick 1.0 as RingQtQuick ListView { id: accountList interactive: false height: totalHeight implicitHeight: totalHeight - model: RingQtQuick.session.accountModel + model: RingSession.accountModel property real totalHeight: footerItem + contentHeight + headerItem + 10 property real footerItem: 0 property real headerItem: 0 property bool enableAdd: true Component { id: accountErrorComponent RowLayout { anchors.fill: parent Image { Layout.fillHeight: true fillMode: Image.PreserveAspectFit width: parent.width sourceSize.width: 22 sourceSize.height: 22 horizontalAlignment: Image.AlignHCenter source: "image://SymbolicColorizer/:/sharedassets/outline/warning.svg" } Label { Layout.fillWidth: true Layout.fillHeight: true text: error color: activePalette.text wrapMode: Text.WordWrap width: parent.width } } } Component { id: defaultAccountComponent RowLayout { CheckBox { Layout.fillHeight: true Layout.preferredWidth: Kirigami.Units.fontMetrics.height * 2 Layout.minimumWidth: Kirigami.Units.fontMetrics.height * 2 checked: obj.enabled onClicked: { obj.enabled = checked obj.performAction(RingQtQuick.Account.SAVE) } } Rectangle { height: Kirigami.Units.fontMetrics.height * 0.66 width: Kirigami.Units.fontMetrics.height * 0.66 radius: 99 color: obj.registrationState == RingQtQuick.Account.READY ? Kirigami.Theme.positiveTextColor : ( obj.registrationState == RingQtQuick.Account.TRYING ? Kirigami.Theme.neutralTextColor : Kirigami.Theme.negativeTextColor ) } Label { Layout.fillHeight: true Layout.fillWidth: true text: obj.alias } Item { Layout.fillHeight: true KQuickItemViews.DecorationAdapter { pixmap: secIcon anchors.verticalCenter: parent.verticalCenter height: (Kirigami.Units.fontMetrics.height * 2) - 6 width: (Kirigami.Units.fontMetrics.height * 2) - 6 } } // Do not cover the handle Item { width: (Kirigami.Units.fontMetrics.height * 2) } } } Component { id: errorComponent RowLayout { anchors.fill: parent CheckBox { Layout.fillHeight: true Layout.preferredWidth: Kirigami.Units.fontMetrics.height * 2 Layout.minimumWidth: Kirigami.Units.fontMetrics.height * 2 checked: obj.enabled onClicked: { obj.enabled = checked obj.performAction(RingQtQuick.Account.SAVE) } } Rectangle { height: Kirigami.Units.fontMetrics.height * 0.66 width: Kirigami.Units.fontMetrics.height * 0.66 radius: 99 color: obj.registrationState == RingQtQuick.Account.READY ? Kirigami.Theme.positiveTextColor : ( obj.registrationState == RingQtQuick.Account.TRYING ? Kirigami.Theme.neutralTextColor : Kirigami.Theme.negativeTextColor ) } ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true Loader { property string error: obj.lastErrorMessage property int code: obj.lastErrorCode id: accountError Layout.minimumHeight: active ? Kirigami.Units.fontMetrics.height * 1.5 : 0 Layout.fillWidth: true active: true sourceComponent: accountErrorComponent } Label { Layout.fillHeight: true Layout.fillWidth: true text: obj.alias } } KQuickItemViews.DecorationAdapter { pixmap: secIcon anchors.verticalCenter: parent.verticalCenter height: (Kirigami.Units.fontMetrics.height * 2) - 6 width: (Kirigami.Units.fontMetrics.height * 2) - 6 } // Do not cover the handle Item { width: (Kirigami.Units.fontMetrics.height * 2) } } } Loader { id: accountDeleter property string name: "" property var account: "" active: false sourceComponent: Dialog { height: 150 parent: applicationWindow().contentItem x: applicationWindow().contentItem.width / 2 - width/2 y: applicationWindow().contentItem.height / 2 - height/2 standardButtons: Dialog.Ok | Dialog.Cancel closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent modal: true title: i18n("Delete an account") Label { text: i18n("
Are you sure you want to delete the account called ") + name + i18n(".

This cannot be undone and you will lose the account permanently
") } onAccepted: { accountDeleter.active = false RingSession.accountModel.remove(account) RingSession.accountModel.save() accountDeleter.account = null } onRejected: { accountDeleter.active = false accountDeleter.account = null } } } delegate: Kirigami.SwipeListItem { property bool hasProblems: object.enabled && registrationState != RingQtQuick.Account.READY height: Kirigami.Units.fontMetrics.height * (hasProblems ? 3.5 : 2) width: accountList.width actions: [ Kirigami.Action { iconName: "message-news" text: i18n("Status logs") onTriggered: { object.performAction(RingQtQuick.Account.RELOAD) } }, Kirigami.Action { iconName: "document-share" text: i18n("Share") onTriggered: { //TODO } }, Kirigami.Action { iconName: "edit-delete" text: i18n("Delete") onTriggered: { accountDeleter.name = alias accountDeleter.account = object accountDeleter.active = true accountDeleter.item.open() //applicationWindow().globalDrawer.drawerOpen = false //FIXME } }, Kirigami.Action { iconName: "view-refresh" text: i18n("Reload") onTriggered: { object.performAction(RingQtQuick.Account.RELOAD) } } ] Loader { anchors.fill: parent property QtObject obj: object property var secIcon: securityLevelIcon sourceComponent: hasProblems ? errorComponent : defaultAccountComponent } } header: Kirigami.Heading { level: 2 text: i18n("Accounts") Component.onCompleted: { headerItem = Math.max(height, implicitHeight) } onHeightChanged: { headerItem = Math.max(height, implicitHeight) } } footer: OutlineButton { id: mainArea height: enableAdd ? fontMetrics.height * 3.5 : 0 expandedHeight: fontMetrics.height * 3.5 sideMargin: 2 width: parent.width label: i18n("Add an account") topPadding: 2 visible: enableAdd onClicked: { applicationWindow().globalDrawer.drawerOpen = false ActionCollection.showWizard.trigger() } Component.onCompleted: { footerItem = Math.max(height, implicitHeight) } onHeightChanged: { footerItem = Math.max(height, implicitHeight) } } } diff --git a/src/cmd.cpp b/src/cmd.cpp index 3775301f..d430ffcf 100644 --- a/src/cmd.cpp +++ b/src/cmd.cpp @@ -1,221 +1,221 @@ /*************************************************************************** * Copyright (C) 2013-2015 by Savoir-Faire Linux * * 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 "cmd.h" //Qt #include #include #include #include //KDE #include #include //Ring #include #include #include #include #include "ringapplication.h" -#include "klib/kcfg_settings.h" +#include "kcfg_settings.h" //Static definition Cmd* Cmd::m_spSelf = nullptr; ///(Private) constructor Cmd::Cmd(QObject* parent) : QObject(parent) { } ///Signleton Cmd* Cmd::instance() { if (!m_spSelf) { m_spSelf = new Cmd(); } return m_spSelf; } ///Setup command line options before passing them to the KUniqueApplication bool Cmd::parseCmd(int argc, char **argv, KAboutData& about) { Q_UNUSED(argc) Q_UNUSED(argv) QCoreApplication* app = QCoreApplication::instance(); QCommandLineOption call (QStringList { "place-call" }, i18n("Place a call to a given number" ), QStringLiteral("number" ), QLatin1String("")); QCommandLineOption text (QStringList { "send-text" }, i18n("Send a text to <number>, use --message to set the content, then hangup"), QStringLiteral("number" ), QLatin1String("")); QCommandLineOption message (QStringList { "message" }, i18n("Used in combination with --send-text" ), QStringLiteral("content"), QLatin1String("")); QCommandLineOption icon (QStringList { "iconify" }, i18n("Start in the system tray" ) ); QCommandLineOption showPhone (QStringList { "phone" }, i18n("Start with the phone interface" ) ); QCommandLineOption showTimeL (QStringList { "timeline" }, i18n("Start with the timeline interface" ) ); QCommandLineParser parser; parser.addOptions({call,text,message,icon,showPhone,showTimeL}); about.setupCommandLine(&parser); parser.process(*app); about.processCommandLine(&parser); const auto versionOption = parser.addVersionOption(); const auto helpOption = parser.addHelpOption (); if (parser.isSet(versionOption) || parser.isSet(helpOption)) return false; RingApplication::instance()->init(); if (parser.isSet(call)) placeCall(parser.value(call)); if (parser.isSet(icon)) iconify(); if (parser.isSet(showPhone)) phoneInterface(); if (parser.isSet(showTimeL)) timelineInterface(); if (parser.isSet(text) && parser.isSet(message)) sendText(parser.value(text),parser.value(message)); return true; } ///Place a call (from the command line) void Cmd::placeCall(const QString& number) { if (number.isEmpty()) { qWarning() << "Example: --place-call 123@example.com"; return; } //Wait until the initialization is done QTimer::singleShot(0,[number] { Call* call = Session::instance()->callModel()->dialingCall(); call->reset(); call->appendText(number); call->performAction(Call::Action::ACCEPT); }); } ///Send a text ans hang up (from the command line) void Cmd::sendText(const QString& number, const QString& text) { Q_UNUSED(number) Q_UNUSED(text) QTimer::singleShot(0,[number,text] { Call* call = Session::instance()->callModel()->dialingCall(); call->reset(); call->appendText(number); call->setProperty("message",text); QObject::connect(call,&Call::lifeCycleStateChanged,[text,call](const Call::LifeCycleState st) { if (st == Call::LifeCycleState::PROGRESS) { call->addOutgoingMedia()->send({{"text/plain",call->property("message").toString()}}); call->performAction(Call::Action::REFUSE); //HangUp } }); call->performAction(Call::Action::ACCEPT); }); } void Cmd::iconify() { if (RingApplication::instance()) { RingApplication::instance()->setIconify(true); } } void Cmd::phoneInterface() { //FIXME } void Cmd::timelineInterface() { //FIXME } void Cmd::slotActivateActionRequested (const QString&, const QVariant&) { } /** * This function is called when a new client try to open. It will stop but this * process need to take care of its arguments. */ void Cmd::slotActivateRequested (const QStringList& args, const QString& cwd) { Q_UNUSED(cwd) enum class Current { NONE , /* No args */ PLACE_CALL, /* One arg */ SEND_TEXT , /* One arg */ MESSAGE , /* One arg */ MINIMIZED /* No args */ }; Current current = Current::NONE; bool sendMessage = false; QStringList messages; QString sendTextTo; for(const QString& arg : args) { if (current != Current::NONE) { switch(current) { case Current::NONE : case Current::MINIMIZED : //Iconify do nothing when the executable is already started break; case Current::SEND_TEXT : sendTextTo = arg; break; case Current::PLACE_CALL: placeCall(arg); break; case Current::MESSAGE : messages << arg; break; } } else { if (arg == QLatin1String("--place-call")) current = Current::PLACE_CALL; else if (arg == QLatin1String("--send-text")) sendMessage = true; else if (arg == QLatin1String("--message")) current = Current::MESSAGE; else if (arg == QLatin1String("--iconify")) {}//TODO } } if (sendMessage && sendTextTo.size() && messages.size()) { foreach (const QString& msg, messages) sendText(sendTextTo, msg); } } void Cmd::slotOpenRequested (const QList&) { } // kate: space-indent on; indent-width 3; replace-tabs on; diff --git a/src/conf/dlggeneral.cpp b/src/conf/dlggeneral.cpp deleted file mode 100644 index 6a09cf6f..00000000 --- a/src/conf/dlggeneral.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2009-2015 by Savoir-Faire Linux * - * Author : Jérémy Quentin * - * 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 General Public License * - * along with this program. If not, see . * - ***************************************************************************/ -#include "dlggeneral.h" - -//Qt -#include -#include -#include - -//KDE -#include -#include - -//Ring -#include "klib/kcfg_settings.h" -#include "callhistorymodel.h" -#include "session.h" - -///Constructor -DlgGeneral::DlgGeneral(KConfigDialog *parent) - : QWidget(parent),m_HasChanged(false) -{ -// setupUi(this); -// connect(toolButton_historyClear, &QAbstractButton::clicked, this, &DlgGeneral::slotClearCallHistoryAsked); -// const bool isLimited = Session::instance()->historyModel()->isHistoryLimited(); -// m_pKeepHistory->setChecked(!isLimited); -// m_pHistoryMax ->setEnabled(isLimited ); -// -// m_pHistoryMax->setValue(Session::instance()->historyModel()->historyLimit()); -// m_HasChanged = false; -} - -///Destructor -DlgGeneral::~DlgGeneral() -{ -} - -///Have this dialog changed -bool DlgGeneral::hasChanged() -{ - return m_HasChanged; -} - -///Tag this dialog as changed -void DlgGeneral::slotChanged() -{ - m_HasChanged = true; - emit updateButtons(); -} - -///Update all widgets -void DlgGeneral::updateWidgets() -{ -} - -///Save current settings -void DlgGeneral::updateSettings() -{ -// Session::instance()->historyModel()->setHistoryLimited(!m_pKeepHistory->isChecked()); -// -// if (!m_pKeepHistory->isChecked()) -// Session::instance()->historyModel()->setHistoryLimit(m_pHistoryMax->value()); -// -// m_HasChanged = false; -} - -void DlgGeneral::slotClearCallHistoryAsked() -{ -// Session::instance()->historyModel()->clearAllCollections(); -} - -// kate: space-indent on; indent-width 3; replace-tabs on; diff --git a/src/conf/dlggeneral.h b/src/conf/dlggeneral.h deleted file mode 100644 index d5c34b01..00000000 --- a/src/conf/dlggeneral.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2009-2015 by Savoir-Faire Linux * - * Author : Jérémy Quentin * - * 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 General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - -#ifndef DLGGENERAL_H -#define DLGGENERAL_H - -#include -#include - -// #include "ui_dlggeneralbase.h" - -/** - @author Jérémy Quentin -*/ -class DlgGeneral final : public QWidget -{ -Q_OBJECT -public: - //Constructor - explicit DlgGeneral(KConfigDialog *parent = nullptr); - - //Destructor - virtual ~DlgGeneral(); - - bool hasChanged(); - bool m_HasChanged; - -public Q_SLOTS: - //Mutator - void updateWidgets(); - void updateSettings(); - void slotClearCallHistoryAsked(); - -public Q_SLOTS: - void slotChanged(); - -Q_SIGNALS: - ///Emitted when the buttons need to be updated - void updateButtons(); - void clearCallHistoryAsked(); - -}; - -#endif - -// kate: space-indent on; indent-width 3; replace-tabs on; diff --git a/src/conf/dlggeneralbase.ui b/src/conf/dlggeneralbase.ui deleted file mode 100644 index cf4bed85..00000000 --- a/src/conf/dlggeneralbase.ui +++ /dev/null @@ -1,284 +0,0 @@ - - - DlgGeneralBase - - - - 0 - 0 - 525 - 404 - - - - General settings - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - This module is deprecated and only exists to import history from SFLPhone 1.2 and Ring-KDE 2.x - - - true - - - - - - - false - - - - 0 - 0 - - - - Ca&ll History - - - true - - - - - - - - Clear History - - - - .. - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - false - - - Keep history forever - - - - - - - false - - - Automatically remove calls after - - - - - - - false - - - - 0 - 0 - - - - QAbstractSpinBox::PlusMinus - - - 1 - - - 10000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - days - - - - - - - - - - Display - - - - - - Merge calls with the same day and peer - - - - - - - Display incoming, outgoing and missed for history items - - - - - - - Highlight missed outgoing calls - - - - - - - Highlight missed incoming calls - - - - - - - Those settings only take effect after restarting Ring-KDE - - - - - - - - - - Qt::Vertical - - - - 504 - 171 - - - - - - - - - - - - m_pKeepHistory - toggled(bool) - m_pHistoryMax - setDisabled(bool) - - - 152 - 43 - - - 301 - 95 - - - - - m_pHistoryMax - valueChanged(int) - DlgGeneralBase - slotChanged() - - - 301 - 95 - - - 474 - 69 - - - - - m_pKeepHistory - toggled(bool) - DlgGeneralBase - slotChanged() - - - 95 - 43 - - - 492 - 28 - - - - - - slotChanged() - - diff --git a/src/delegates/kdepixmapmanipulation.cpp b/src/delegates/kdepixmapmanipulation.cpp deleted file mode 100644 index ee68a59c..00000000 --- a/src/delegates/kdepixmapmanipulation.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2013-2014 by Savoir-Faire Linux * - * 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 General Public License * - * along with this program. If not, see . * - ***************************************************************************/ -#include "kdepixmapmanipulation.h" - -//Qt -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//KDE -#include -#include - - -//Ring -#include -#include -#include -#include -#include -#include -#include -#include