KCM skeleton

This commit is contained in:
Albert Vaca 2013-06-19 16:15:25 +02:00
parent 392e010a30
commit 6e53c5b9c7
8 changed files with 341 additions and 1 deletions

View file

@ -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})

21
kcm/CMakeLists.txt Normal file
View file

@ -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})

78
kcm/kcm.cpp Normal file
View file

@ -0,0 +1,78 @@
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "kcm.h"
#include "ui_kcm.h"
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>
#include <QtGui/QStackedLayout>
#include <QtGui/QListView>
#include <KDebug>
#include <kpluginfactory.h>
#include <kstandarddirs.h>
K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();)
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"

55
kcm/kcm.h Normal file
View file

@ -0,0 +1,55 @@
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef KDECONNECTKCM_H
#define KDECONNECTKCM_H
#include <kcmodule.h>
#include <qstandarditemmodel.h>
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

111
kcm/kcm.ui Normal file
View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KdeConnectKcmUi</class>
<widget class="QWidget" name="KdeConnectKcmUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>949</width>
<height>528</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QListView" name="deviceList"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-remove">
<normaloff/>
</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="deviceInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

20
kcm/kdeconnect-kcm.desktop Executable file
View file

@ -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;

54
kcm/wizzard.ui Normal file
View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>361</width>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
<string>Wizard</string>
</property>
<widget class="QWizardPage" name="wizardPage1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Bla bla bla blo blo blo&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href=&quot;https://accounts.google.com/ServiceLogin?service=googleplay&amp;amp;passive=86400&amp;amp;continue=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.melloware.zeroconf%26hl%3Den%26rdid%3Dcom.melloware.zeroconf%26rdot%&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;Click Here!&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Select your device</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listView"/>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage3"/>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -14,4 +14,3 @@ target_link_libraries(kded_androidshine_tests
add_test(kded_androidshine_tests ${CMAKE_CURRENT_BINARY_DIR}/kded_androidshine_tests)