Commit 3b3754c4 authored by Dimitris Kardarakos's avatar Dimitris Kardarakos

Initial commit

parents
.kdev4/
build/
plasmamobile-calendar.kdev4
project(mobilecalendar)
cmake_minimum_required(VERSION 2.8.12)
set(KF5_MIN_VERSION "5.18.0")
set(QT_MIN_VERSION "5.5.0")
################# Disallow in-source build #################
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "Mobile Calendar requires an out of source build. Please create a separate build directory.")
endif()
# Make CPack available to easy generate binary packages
include(CPack)
include(FeatureSummary)
################# set KDE specific information #################
find_package(ECM 0.0.8 REQUIRED NO_MODULE)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(ECMPoQmTools)
include(KDECompilerSettings NO_POLICY_SCOPE)
set(KF5_VERSION "5.22.0")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2)
find_package(KF5Config ${KF5_DEP_VERSION} "5.22.0")
find_package(KF5Kirigami2 ${KF5_DEP_VERSION} "5.22.0")
################# Enable C++11 features for clang and gcc #################
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x")
endif()
################# now find all used packages #################
set (QT_MIN_VERSION "5.6.0")
find_package(PkgConfig)
#########################################################################
add_subdirectory(src)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
ecm_install_po_files_as_qm(po)
endif()
install(FILES org.kde.phone.mobilecalendar.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(PROGRAMS org.kde.phone.mobilecalendar.desktop DESTINATION ${KDE_INSTALL_APPDIR})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
This diff is collapsed.
# Mobile Calendar
Calendar for Plasma Mobile
# Installation
mkdir build
cd build
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON ..
make
(sudo) make install
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
<id>org.kde.phone.mobilecalendar.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3+</project_license>
<name>Mobile Calendar</name>
<summary>=Mobile Calendar</summary>
<description>
<p>
<ul>
<li>Mobile</li>
<li>Agenda</li>
<li>Events</li>
</ul>
</p>
</description>
<url type="bugtracker">https://phabricator.kde.org/T6942</url>
<screenshots>
<screenshot type="default">
</screenshot>
</screenshots>
<project_group>KDE</project_group>
<provides>
<binary>mobilecalendar</binary>
</provides>
</component>
[Desktop Entry]
Name=Mobile Calendar
Comment=Mobile Calendar
Version=0.1
Exec=mobilecalendar
MimeType=application/x-mobilecalendar;
Icon=languages
Type=Application
Terminal=false
Categories=Qt;KDE;
if (NOT STATIC_LIBRARY)
ecm_create_qm_loader(mobilecalendar_QM_LOADER mobilecalendar_qt)
endif()
set(mobilecalendar_SRCS
main.cpp
)
qt5_add_resources(RESOURCES resources.qrc)
# Plugin directory
add_subdirectory(plugins)
add_executable(mobilecalendar ${mobilecalendar_SRCS} ${RESOURCES})
target_link_libraries(mobilecalendar Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg KF5::ConfigCore)
install(TARGETS mobilecalendar ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES contents/ui/mobilecalendar.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
#! /usr/bin/env bash
$EXTRACT_TR_STRINGS `find . -name \*.qml` -o $podir/mobilecalendar_qt.pot
rm -f rc.cpp
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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.Layouts 1.11
import QtQuick.Controls 2.4 as Controls2
import org.kde.kirigami 2.5 as Kirigami
Item {
ColumnLayout {
spacing: 10
// Controls2.Label {
// Layout.preferredHeight: 40
// Layout.preferredWidth: 40
//
// text: "Plasma Mobile Calendar"
// color: Kirigami.Theme.textColor
// font.pixelSize: Kirigami.Units.gridUnit
// }
PlayMonthView {
Layout.preferredHeight: 350
Layout.preferredWidth: 350
}
}
}
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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.1
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4 as QuickControls
import org.kde.kirigami 2.0 as Kirigami
import org.kde.phone.mobilecalendar 0.1 as MobileCalendar
Kirigami.ApplicationWindow {
id: root
globalDrawer: Kirigami.GlobalDrawer {
id: drawer
title: "Mobile Calendar"
contentItem.implicitWidth: Math.min (Kirigami.Units.gridUnit * 15, root.width * 0.8)
topContent: Column {
spacing: Kirigami.Units.gridUnit * 2
}
}
pageStack.initialPage: [calendarDashboardComponent]
Component {
id: calendarDashboardComponent
Kirigami.ScrollablePage {
anchors.fill: parent
title: qsTr("Mobile Calendar")
mainItem: CalendarView {
id: calendarView
height: 300
width: 300
}
}
}
MobileCalendar.Config {
id: mobileCalendarConfig;
}
}
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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 org.kde.kirigami 2.5 as Kirigami
Main {
id: root
contextDrawer: null
pageStack.defaultColumnWidth: pageStack.width > Kirigami.Units.gridUnit * 25 ? pageStack.width / 2 : pageStack.width
}
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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.4 as Controls2
import QtQuick.Layouts 1.11
import Qt.labs.calendar 1.0 as Labs //TODO: To be removed, added just to provide a model
import org.kde.kirigami 2.0 as Kirigami
Item {
id: monthview
property int days: 7
property int weeks: 6
property date currentDate: new Date()
// HACK: Added only as a temporary model provider, to be replaced with the real model provider
Labs.AbstractMonthGrid {
id: monthModelProvider
}
//HACK:Added only as a temporary model provider, to be replaced with the real model provider
Labs.AbstractDayOfWeekRow {
id: weekModelProvider
}
ColumnLayout {
spacing: 0
RowLayout {
spacing: 10
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: Kirigami.Units.gridUnit/2
Controls2.ToolButton {
id: previous_month
width: Kirigami.Units.gridUnit*2
height: width
icon.name: "go-previous"
onClicked: {
var prv = monthModelProvider.month - 1 ;
if (prv == -1 ) {
monthModelProvider.month = 11;
--monthModelProvider.year;
}
else {
monthModelProvider.month = prv
}
}
}
Controls2.Label {
color: Kirigami.Theme.textColor
font.pixelSize: Kirigami.Units.gridUnit
text: Qt.formatDate(new Date(monthModelProvider.year, monthModelProvider.month), "MMM yyyy")
}
Controls2.ToolButton {
id: next_month
width: Kirigami.Units.gridUnit*2
height: width
icon.name: "go-next"
onClicked: {
var nxt = monthModelProvider.month + 1 ;
if (nxt == 12) {
monthModelProvider.month = 0;
++monthModelProvider.year;
}
else {
monthModelProvider.month = nxt
}
}
}
}
Rectangle {
height: 1
Layout.fillWidth: true
color: Kirigami.Theme.disabledTextColor
}
RowLayout {
spacing: 0
Repeater {
model: weekModelProvider.source
delegate: weekDayDelegate
}
}
Grid {
Layout.fillWidth: true
columns: monthview.days
rows: monthview.weeks
Repeater {
model: monthModelProvider.source
delegate: monthDayDelegate
}
}
}
/**
* Month Day Delegate
*/
Component {
id: monthDayDelegate
Rectangle {
width: childrenRect.width
height: childrenRect.height
opacity: dayButton.currentDate ? 0.4 : 1
color: dayButton.currentDate ? Kirigami.Theme.textColor : Kirigami.Theme.backgroundColor
border.color: Kirigami.Theme.disabledTextColor
Controls2.ToolButton {
id: dayButton
property bool currentDate: Qt.formatDate(model.date, "MM-dd-yyyy") ==
Qt.formatDate(monthview.currentDate, "MM-dd-yyyy")
width: Kirigami.Units.gridUnit*2
height: width
checkable: true
text: model.day
}
}
}
/**
* Week Day Delegate
*/
Component {
id: weekDayDelegate
Rectangle {
width: childrenRect.width
height: childrenRect.height
color: Kirigami.Theme.textColor
opacity: 0.4
Controls2.ToolButton {
id: dayButton
width: Kirigami.Units.gridUnit*2
height: width
text: model.shortName
}
}
}
}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m 7,4 c 0,0 -1,-3e-5 -1,1 l -2,0 0,3 0,11 0,1 16,0 0,-1 0,-11 0,-3 -2,0 C 18,3.99997 17,4 17,4 l -3,0 c 0,0 -1,-3e-5 -1,1 L 11,5 C 11,3.99997 10,4 10,4 L 7,4 Z m 0,1 3,0 0,1 -3,0 0,-1 z m 7,0 3,0 0,1 -3,0 0,-1 z M 5,8 19,8 19,19 5,19 5,8 Z m 2,1 0,2 2,0 0,-2 -2,0 z m 4,0 0,2 2,0 0,-2 -2,0 z m 4,0 0,2 2,0 0,-2 -2,0 z m -8,3 0,2 2,0 0,-2 -2,0 z m 4,0 0,2 2,0 0,-2 -2,0 z m 4,0 0,2 2,0 0,-2 -2,0 z m 0,3 0,2 2,0 0,-2 -2,0 z"
class="ColorScheme-Text"
/>
</svg>
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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.1
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.0 as Kirigami
Main {
id: root
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
}
pageStack.defaultColumnWidth: pageStack.width > Kirigami.Units.gridUnit * 25 ? pageStack.width / 2 : pageStack.width
}
/*
* Copyright 2018 Dimitris Kardarakos <dimkard@gmail.com>
*
* 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 Library 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.
*/
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QUrl>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("KDE");
QCoreApplication::setOrganizationDomain("phone.kde.org");
QCoreApplication::setApplicationName("Mobile Calendar");
QQmlApplicationEngine engine;
if (!(QString::fromLatin1(qgetenv("DESKTOP_SESSION")).isEmpty())) {
engine.load(QUrl(QStringLiteral("qrc:///desktopmain.qml")));
}
else {
engine.load(QUrl(QStringLiteral("qrc:///mobilemain.qml")));
}
if (engine.rootObjects().isEmpty()) {
return -1;
}
int ret = app.exec();
return ret;
}
set(qmlplugin_SRCS
qmlplugin.cpp
MobileCalendarConfig.cpp
)
add_library (mobilecalendarqmlplugin SHARED ${qmlplugin_SRCS})
target_link_libraries (mobilecalendarqmlplugin
Qt5::Core
Qt5::Qml
Qt5::Quick
KF5::ConfigCore
# KF5::KIOCore
# KF5::KIOWidgets
)
install (TARGETS mobilecalendarqmlplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/phone/mobilecalendar)
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/phone/mobilecalendar)
/*
* Copyright (C) 2018 Dimitris Kardarakos
*
* This library 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 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "MobileCalendarConfig.h"
#include <KConfig>
#include <KConfigGroup>
class MobileCalendarConfig::Private
{
public:
Private()
: config("mobilecalendarrc")
{};
KConfig config;
};
MobileCalendarConfig::MobileCalendarConfig(QObject* parent)
: QObject(parent)
, d(new Private)
{
QString viewMode = d->config.group("general").readEntry("view_mode", QString());
if(viewMode.isEmpty()) {
d->config.sync();
}
}
MobileCalendarConfig::~MobileCalendarConfig()
{
delete d;
}
QString MobileCalendarConfig::viewMode() const
{
QString viewMode = d->config.group("general").readEntry("view_mode", QString());
return viewMode;
}
void MobileCalendarConfig::setviewMode(const QString & mode)
{
d->config.group("general").writeEntry("view_mode", mode);
d->config.sync();
emit viewModeChanged();
}
/*
* Copyright (C) 2018 Dimitris Kardarakos
*
* This library 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 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef MOBILECALENDARCONFIG_G
#define MOBILECALENDARCONFIG_G
#include <QObject>
class MobileCalendarConfig : public QObject
{
Q_OBJECT
Q_PROPERTY(QString viewMode READ viewMode WRITE setviewMode NOTIFY viewModeChanged)
public:
explicit MobileCalendarConfig(QObject* parent = nullptr);
~MobileCalendarConfig() override;
QString viewMode() const;
Q_INVOKABLE void setviewMode(const QString& mode);
Q_SIGNAL void viewModeChanged();
private:
class Private;
Private* d;
};
#endif
module org.kde.phone.mobilecalendar
plugin mobilecalendarqmlplugin
/*
* Copyright (C) 2018 Dimitris Kardarakos
*
* This library 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 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "qmlplugin.h"
#include "MobileCalendarConfig.h"
#include <QQmlEngine>
#include <QtQml/qqml.h>
void QmlPlugins::registerTypes(const char *uri)
{
qmlRegisterType<MobileCalendarConfig>(uri, 0, 1, "Config");
}
/*
* Copyright (C) 2018 Dimitris Kardarakos
*
* This library 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 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 library. If not, see <http://www.gnu.org/licenses/>.