From 6e53c5b9c78422564dd783bd3741a0a83f853dee Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Wed, 19 Jun 2013 16:15:25 +0200 Subject: [PATCH] KCM skeleton --- daemon/CMakeLists.txt | 2 + kcm/CMakeLists.txt | 21 +++++++ kcm/kcm.cpp | 78 ++++++++++++++++++++++++++ kcm/kcm.h | 55 ++++++++++++++++++ kcm/kcm.ui | 111 +++++++++++++++++++++++++++++++++++++ kcm/kdeconnect-kcm.desktop | 20 +++++++ kcm/wizzard.ui | 54 ++++++++++++++++++ test/CMakeLists.txt | 1 - 8 files changed, 341 insertions(+), 1 deletion(-) create mode 100644 kcm/CMakeLists.txt create mode 100644 kcm/kcm.cpp create mode 100644 kcm/kcm.h create mode 100644 kcm/kcm.ui create mode 100755 kcm/kdeconnect-kcm.desktop create mode 100644 kcm/wizzard.ui diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 41d21abf8..0317020da 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -24,6 +24,8 @@ target_link_libraries(kded_androidshine ${KDE4_KDEUI_LIBS} kdnssd ${QT_QTNETWORK_LIBRARY} + ${QJSON_LIBRARIES} + ${QJSON_LIBRARY} ) install(TARGETS kded_androidshine DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/kcm/CMakeLists.txt b/kcm/CMakeLists.txt new file mode 100644 index 000000000..a27b50519 --- /dev/null +++ b/kcm/CMakeLists.txt @@ -0,0 +1,21 @@ + +set(kcm_SRCS + kcm.cpp +) + +qt4_automoc(${kcm_SRCS}) + +kde4_add_ui_files(kcm_SRCS kcm.ui wizzard.ui) + +kde4_add_plugin(kdeconnect-kcm ${kcm_SRCS}) + +target_link_libraries(kdeconnect-kcm + ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${KDE4_KDEUI_LIBRARY} + ${KDE4_KIO_LIBRARY} +) + +install(TARGETS kdeconnect-kcm DESTINATION ${PLUGIN_INSTALL_DIR}) + +install(FILES kdeconnect-kcm.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp new file mode 100644 index 000000000..46b6db136 --- /dev/null +++ b/kcm/kcm.cpp @@ -0,0 +1,78 @@ +/** + * Copyright 2013 Albert Vaca + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 "kcm.h" +#include "ui_kcm.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin();) +K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm")) + +KdeConnectKcm::KdeConnectKcm(QWidget *parent, const QVariantList&) + : KCModule(KdeConnectKcmFactory::componentData(), parent) +{ + m_ui = new Ui::KdeConnectKcmUi(); + m_ui->setupUi(this); + + m_model = new QStandardItemModel(this); + //m_selectionModel = new QItemSelectionModel(m_model); + //connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentChanged(QModelIndex,QModelIndex))); + //m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent); + + m_ui->deviceList->setIconSize(QSize(32,32)); + m_ui->deviceList->setModel(m_model); + //m_ui->deviceList->setSelectionModel(m_selectionModel); + + connect(m_ui->removeButton, SIGNAL(clicked(bool)), this, SLOT(removeButtonClicked())); + connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked())); +} + +KdeConnectKcm::~KdeConnectKcm() +{ + +} + +void KdeConnectKcm::addButtonClicked() +{ + +} + +void KdeConnectKcm::removeButtonClicked() +{ + +} + +void KdeConnectKcm::currentChanged(const QModelIndex& current, const QModelIndex& previous) +{ + +} + +#include "kcm.moc" diff --git a/kcm/kcm.h b/kcm/kcm.h new file mode 100644 index 000000000..ee7674333 --- /dev/null +++ b/kcm/kcm.h @@ -0,0 +1,55 @@ +/** + * Copyright 2013 Albert Vaca + * + * 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 2 of + * the License or (at your option) version 3 or any later version + * accepted by the membership of KDE e.V. (or its successor approved + * by the membership of KDE e.V.), which shall act as a proxy + * defined in Section 14 of version 3 of the license. + * + * 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 . + */ + +#ifndef KDECONNECTKCM_H +#define KDECONNECTKCM_H + +#include +#include + +class Create; +class QModelIndex; +class AccountsModel; +class AccountWidget; +class QStackedLayout; +class QItemSelectionModel; +namespace Ui { + class KdeConnectKcmUi; +} + +class KdeConnectKcm : public KCModule +{ +Q_OBJECT +public: + KdeConnectKcm(QWidget *parent, const QVariantList&); + virtual ~KdeConnectKcm(); + +private Q_SLOTS: + void addButtonClicked(); + void removeButtonClicked(); + void currentChanged(const QModelIndex& current, const QModelIndex& previous); + +private: + Ui::KdeConnectKcmUi* m_ui; + QStandardItemModel* m_model; + +}; + +#endif diff --git a/kcm/kcm.ui b/kcm/kcm.ui new file mode 100644 index 000000000..e8b0261bc --- /dev/null +++ b/kcm/kcm.ui @@ -0,0 +1,111 @@ + + + KdeConnectKcmUi + + + + 0 + 0 + 949 + 528 + + + + + 0 + 0 + + + + Form + + + + + + + 0 + 0 + + + + + 200 + 16777215 + + + + + 0 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + diff --git a/kcm/kdeconnect-kcm.desktop b/kcm/kdeconnect-kcm.desktop new file mode 100755 index 000000000..152532b98 --- /dev/null +++ b/kcm/kdeconnect-kcm.desktop @@ -0,0 +1,20 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Exec=kcmshell4 kdeconnect-kcm +Icon=applications-internet +Type=Service + +X-KDE-ServiceTypes=KCModule + +X-KDE-Library=kdeconnect-kcm +X-KDE-ParentApp=kcontrol + +X-KDE-System-Settings-Parent-Category=hardware + +Name=KdeConnect + +Comment=Connect your smartphone and your desktop + +X-KDE-Keywords=Network,Android,Devices + +Categories=Qt;KDE;X-KDE-settings-kdeconnect-kcm; diff --git a/kcm/wizzard.ui b/kcm/wizzard.ui new file mode 100644 index 000000000..b3173b8da --- /dev/null +++ b/kcm/wizzard.ui @@ -0,0 +1,54 @@ + + + Wizard + + + + 0 + 0 + 361 + 293 + + + + Wizard + + + + + + + <html><head/><body><p>Bla bla bla blo blo blo<br/><br/><br/><br/><a href="https://accounts.google.com/ServiceLogin?service=googleplay&amp;passive=86400&amp;continue=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.melloware.zeroconf%26hl%3Den%26rdid%3Dcom.melloware.zeroconf%26rdot%"><span style=" text-decoration: underline; color:#0057ae;">Click Here!</span></a></p></body></html> + + + Qt::RichText + + + true + + + Qt::TextBrowserInteraction + + + + + + + + + + + Select your device + + + + + + + + + + + + + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a44a4e37a..92851e54e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,4 +14,3 @@ target_link_libraries(kded_androidshine_tests add_test(kded_androidshine_tests ${CMAKE_CURRENT_BINARY_DIR}/kded_androidshine_tests) -