Commit 17e588e1 authored by Volker Krause's avatar Volker Krause
Browse files

Update to latest kirigami-addons

Brings Android Qt 6 support.
parent 77c60381
......@@ -8,7 +8,10 @@ if (ANDROID)
lib/androidintegration.cpp
)
generate_export_header(KF5KirigamiDateAndTime BASE_NAME KirigamiDateAndTime)
target_link_libraries(KF5KirigamiDateAndTime PUBLIC Qt::Core Qt::AndroidExtras)
target_link_libraries(KF5KirigamiDateAndTime PUBLIC Qt${QT_MAJOR_VERSION}::Core)
if (QT_MAJOR_VERSION EQUAL "5")
target_link_libraries(KF5KirigamiDateAndTime PUBLIC Qt5::AndroidExtras)
endif()
add_subdirectory(android)
install(TARGETS KF5KirigamiDateAndTime ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
endif()
......@@ -27,22 +30,24 @@ target_sources(itinerary-dateandtimeplugin PRIVATE
)
ecm_target_qml_sources(itinerary-dateandtimeplugin SOURCES
ClockElement.qml
ClockFace.qml
DateInput.qml
DatePicker.qml
DatePopup.qml
DesktopDateInput.qml
MobileDateInput.qml
Hand.qml
TimeLabel.qml
TimePicker.qml
TimeInput.qml
)
ecm_target_qml_sources(itinerary-dateandtimeplugin PATH private SOURCES
private/ClockElement.qml
private/DesktopDateInput.qml
private/Hand.qml
private/MobileDateInput.qml
)
target_link_libraries(itinerary-dateandtimeplugin
Qt::Quick
Qt::Qml
Qt${QT_MAJOR_VERSION}::Quick
Qt${QT_MAJOR_VERSION}::Qml
KF5::I18n
)
if (TARGET KF5KirigamiDateAndTime)
......
......@@ -6,6 +6,7 @@
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "private"
Item {
id: clock
......
......@@ -24,7 +24,7 @@ Loader {
//maybe we need something more like QQC2 combox to handle user changed signals separately from the others
source: Kirigami.Settings.tabletMode ? Qt.resolvedUrl("MobileDateInput.qml") : Qt.resolvedUrl("DesktopDateInput.qml")
source: Kirigami.Settings.tabletMode ? Qt.resolvedUrl("private/MobileDateInput.qml") : Qt.resolvedUrl("private/DesktopDateInput.qml")
onSelectedDateChanged: {
if (item && root.selectedDate) {
......
......@@ -138,7 +138,7 @@ QQC2.Control {
Kirigami.Heading {
id: monthLabel
Layout.fillWidth: true
text: i18nc("%1 is month name, %2 is year", "%1 %2", Qt.locale().standaloneMonthName(selectedDate.getMonth()), String(selectedDate.getFullYear()))
text: i18ndc("kirigami-addons", "%1 is month name, %2 is year", "%1 %2", Qt.locale().standaloneMonthName(selectedDate.getMonth()), String(selectedDate.getFullYear()))
level: 1
}
QQC2.ToolButton {
......@@ -179,7 +179,7 @@ QQC2.Control {
QQC2.TabButton {
id: daysViewCheck
Layout.fillWidth: true
text: i18n("Days")
text: i18nc("kirigami-addons", "Days")
onClicked: pickerView.currentIndex = 0 // dayGrid is first item in pickerView
visible: datepicker.showDays
width: visible ? implicitWidth : 0
......@@ -187,13 +187,13 @@ QQC2.Control {
QQC2.TabButton {
id: monthsViewCheck
Layout.fillWidth: true
text: i18n("Months")
text: i18nc("kirigami-addons", "Months")
onClicked: pickerView.currentIndex = 1
}
QQC2.TabButton {
id: yearsViewCheck
Layout.fillWidth: true
text: i18n("Years")
text: i18nc("kirigami-addons", "Years")
onClicked: pickerView.currentIndex = 2
}
}
......
......@@ -2,11 +2,11 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
import QtQuick 2.3
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3 as Controls
import org.kde.kirigami 2.8 as Kirigami
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as Controls
import org.kde.kirigami 2.19 as Kirigami
/**
* A popup that prompts the user to select a date
......@@ -52,23 +52,29 @@ Kirigami.OverlaySheet {
Controls.Button {
icon.name: "go-previous"
Controls.ToolTip.text: i18n("Previous")
Controls.ToolTip.visible: hovered
Controls.ToolTip.delay: Kirigami.Units.shortDuration
text: i18nd("kirigami-addons", "Previous")
display: Controls.AbstractButton.IconOnly
Controls.ToolTip {
text: parent.text
}
onClicked: datePicker.prevMonth()
}
Controls.Button {
icon.name: "go-jump-today"
Controls.ToolTip.text: i18n("Today")
Controls.ToolTip.visible: hovered
Controls.ToolTip.delay: Kirigami.Units.shortDuration
text: i18nd("kirigami-addons", "Today")
display: Controls.AbstractButton.IconOnly
Controls.ToolTip {
text: parent.text
}
onClicked: datePicker.goToday()
}
Controls.Button {
icon.name: "go-next"
Controls.ToolTip.text: i18n("Next")
Controls.ToolTip.visible: hovered
Controls.ToolTip.delay: Kirigami.Units.shortDuration
text: i18nd("kirigami-addons", "Next")
display: Controls.AbstractButton.IconOnly
Controls.ToolTip {
text: parent.text
}
onClicked: datePicker.nextMonth()
}
}
......@@ -83,7 +89,7 @@ Kirigami.OverlaySheet {
Layout.fillWidth: true
}
Controls.Button {
text: i18n("Cancel")
text: i18nd("kirigami-addons", "Cancel")
icon.name: "dialog-cancel"
onClicked: {
root.cancelled()
......@@ -92,7 +98,7 @@ Kirigami.OverlaySheet {
}
Controls.Button {
text: i18n("Accept")
text: i18nd("kirigami-addons", "Accept")
icon.name: "dialog-ok-apply"
onClicked: {
root.selectedDate = datePicker.selectedDate
......
......@@ -8,6 +8,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.5 as Controls2
import org.kde.kirigami 2.0 as Kirigami
import QtQuick.Layouts 1.11
import "private"
/**
* A large time picker
......
......@@ -10,7 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.android.tools.build:gradle:@Gradle_ANDROID_GRADLE_PLUGIN_VERSION@'
}
}
......
......@@ -7,8 +7,15 @@
#include "androidintegration.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QAndroidJniObject>
#include <QtAndroid>
#else
#include <QCoreApplication>
#include <QJniObject>
// TODO KF6 remove this porting aid
using QAndroidJniObject = QJniObject;
#endif
#include <QDebug>
using namespace KirigamiAddonsDateAndTime;
......@@ -87,12 +94,22 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *)
void AndroidIntegration::showDatePicker(qint64 initialDate)
{
QAndroidJniObject picker("org/kde/kirigamiaddons/dateandtime/DatePicker", "(Landroid/app/Activity;J)V", QtAndroid::androidActivity().object(), initialDate);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QAndroidJniObject activity = QtAndroid::androidActivity();
#else
QJniObject activity = QNativeInterface::QAndroidApplication::context();
#endif
QAndroidJniObject picker("org/kde/kirigamiaddons/dateandtime/DatePicker", "(Landroid/app/Activity;J)V", activity.object(), initialDate);
picker.callMethod<void>("doShow");
}
void AndroidIntegration::showTimePicker(qint64 initialTime)
{
QAndroidJniObject picker("org/kde/kirigamiaddons/dateandtime/TimePicker", "(Landroid/app/Activity;J)V", QtAndroid::androidActivity().object(), initialTime);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QAndroidJniObject activity = QtAndroid::androidActivity();
#else
QJniObject activity = QNativeInterface::QAndroidApplication::context();
#endif
QAndroidJniObject picker("org/kde/kirigamiaddons/dateandtime/TimePicker", "(Landroid/app/Activity;J)V", activity.object(), initialTime);
picker.callMethod<void>("doShow");
}
......@@ -5,7 +5,8 @@
#include <QDate>
#include <QRandomGenerator>
struct MonthModel::Private {
class MonthModel::Private {
public:
int year;
int month;
QCalendar calendar = QCalendar();
......
......@@ -1130,7 +1130,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
#endif
pos += separator.size();
sectionNodes[index].pos = pos;
int *current = 0;
int *current = nullptr;
const SectionNode sn = sectionNodes.at(index);
ParsedSection sect;
......
......@@ -6,7 +6,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.5 as Controls2
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.15 as Kirigami
import QtQuick.Layouts 1.11
......@@ -32,7 +32,7 @@ Controls2.ToolButton {
implicitHeight: Kirigami.Units.gridUnit
implicitWidth: height
radius: width*0.5
color: parent.checked ? Kirigami.Theme.buttonBackgroundColor : "transparent"
color: parent.checked ? Kirigami.Theme.activeBackgroundColor : "transparent"
}
}
......@@ -46,7 +46,7 @@ Controls.TextField { //inherited for style reasons to show we're interactive
active: false
sourceComponent: Component {
DatePopup {
KDT.DatePopup {
onAccepted: {
root.selectedDate = item.selectedDate
active = false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment