Commit 81d1e826 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

KAlarm: port away from KHBox/KVBox

parent 32efcc1c
......@@ -24,9 +24,9 @@
#include <kalarmcal/datetime.h>
#include <ksystemtimezone.h>
#include <kglobal.h>
#include <KLocalizedString>
#include <qapplication.h>
#include <KLocale>
#include <QApplication>
#include "kalarm_debug.h"
using namespace KAlarmCal;
......
......@@ -44,7 +44,6 @@
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kdescendantsproxymodel.h>
#include <khbox.h>
#include <KSharedConfig>
#include <QAction>
......
......@@ -23,8 +23,8 @@
#include <kalarmcal/kaevent.h>
#include <kdialog.h>
#include <klineedit.h>
#include <QVector>
#include <QLineEdit>
class QFocusEvent;
class QTreeView;
......
......@@ -39,7 +39,7 @@
#include <AkonadiCore/resourcesynchronizationjob.h>
#include <KLocalizedString>
#include <kconfiggroup.h>
#include <KConfig>
#include <QTimer>
#include <QStandardPaths>
......
......@@ -54,8 +54,6 @@
#include <KLocalizedString>
#include <kconfig.h>
#include <KSharedConfig>
#include <khbox.h>
#include <kvbox.h>
#include <kwindowsystem.h>
#include <KTimeZone>
......@@ -219,24 +217,31 @@ void EditAlarmDlg::init(const KAEvent* event)
connect(this, &EditAlarmDlg::tryClicked, this, &EditAlarmDlg::slotTry);
connect(this, &EditAlarmDlg::defaultClicked, this, &EditAlarmDlg::slotDefault); // More/Less Options button
connect(this, &EditAlarmDlg::helpClicked, this, &EditAlarmDlg::slotHelp); // Load Template button
KVBox* mainWidget = new KVBox(this);
mainWidget->setMargin(0);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout* mainLayout = new QVBoxLayout(mainWidget);
mainLayout->setMargin(0);
setMainWidget(mainWidget);
if (mTemplate)
{
KHBox* box = new KHBox(mainWidget);
QFrame *frame = new QFrame;
QHBoxLayout* box = new QHBoxLayout();
frame->setLayout(box);
box->setMargin(0);
box->setSpacing(spacingHint());
QLabel* label = new QLabel(i18nc("@label:textbox", "Template name:"), box);
QLabel* label = new QLabel(i18nc("@label:textbox", "Template name:"));
label->setFixedSize(label->sizeHint());
mTemplateName = new QLineEdit(box);
box->addWidget(label);
mTemplateName = new QLineEdit();
mTemplateName->setReadOnly(mReadOnly);
connect(mTemplateName, &QLineEdit::textEdited, this, &EditAlarmDlg::contentsChanged);
label->setBuddy(mTemplateName);
box->setWhatsThis(i18nc("@info:whatsthis", "Enter the name of the alarm template"));
box->setFixedHeight(box->sizeHint().height());
box->addWidget(mTemplateName);
frame->setWhatsThis(i18nc("@info:whatsthis", "Enter the name of the alarm template"));
frame->setFixedHeight(box->sizeHint().height());
mainLayout->addWidget(frame);
}
mTabs = new QTabWidget(mainWidget);
mainLayout->addWidget(mTabs);
mTabScrollGroup = new StackedScrollGroup(this, mTabs);
StackedScrollWidget* mainScroll = new StackedScrollWidget(mTabScrollGroup);
......@@ -253,10 +258,13 @@ void EditAlarmDlg::init(const KAEvent* event)
StackedScrollWidget* recurScroll = new StackedScrollWidget(mTabScrollGroup);
mTabs->addTab(recurScroll, QString());
mRecurPageIndex = 1;
KVBox* recurTab = new KVBox();
recurTab->setMargin(marginHint());
QFrame *recurTab = new QFrame;
QVBoxLayout* recurTabLayout = new QVBoxLayout();
recurTabLayout->setMargin(marginHint());
recurTab->setLayout(recurTabLayout);
recurScroll->setWidget(recurTab); // recurTab becomes the child of recurScroll
mRecurrenceEdit = new RecurrenceEdit(mReadOnly, recurTab);
mRecurrenceEdit = new RecurrenceEdit(mReadOnly);
recurTabLayout->addWidget(mRecurrenceEdit);
connect(mRecurrenceEdit, &RecurrenceEdit::shown, this, &EditAlarmDlg::slotShowRecurrenceEdit);
connect(mRecurrenceEdit, &RecurrenceEdit::typeChanged, this, &EditAlarmDlg::slotRecurTypeChange);
connect(mRecurrenceEdit, &RecurrenceEdit::frequencyChanged, this, &EditAlarmDlg::slotRecurFrequencyChange);
......@@ -318,22 +326,26 @@ void EditAlarmDlg::init(const KAEvent* event)
mTemplateTimeGroup->addButton(mTemplateDefaultTime);
grid->addWidget(mTemplateDefaultTime, 0, 0, Qt::AlignLeft);
KHBox* box = new KHBox(templateTimeBox);
box->setMargin(0);
box->setSpacing(spacingHint());
QFrame *box = new QFrame(templateTimeBox);
QHBoxLayout* layout = new QHBoxLayout();
layout->setMargin(0);
layout->setSpacing(spacingHint());
box->setLayout(layout);
mTemplateUseTime = new RadioButton(i18nc("@option:radio", "Time:"), box);
mTemplateUseTime->setFixedSize(mTemplateUseTime->sizeHint());
mTemplateUseTime->setReadOnly(mReadOnly);
mTemplateUseTime->setWhatsThis(i18nc("@info:whatsthis", "Specify a start time for alarms based on this template."));
layout->addWidget(mTemplateUseTime);
mTemplateTimeGroup->addButton(mTemplateUseTime);
mTemplateTime = new TimeEdit(box);
mTemplateTime = new TimeEdit();
mTemplateTime->setFixedSize(mTemplateTime->sizeHint());
mTemplateTime->setReadOnly(mReadOnly);
mTemplateTime->setWhatsThis(xi18nc("@info:whatsthis",
"<para>Enter the start time for alarms based on this template.</para><para>%1</para>",
TimeSpinBox::shiftWhatsThis()));
connect(mTemplateTime, &TimeEdit::valueChanged, this, &EditAlarmDlg::contentsChanged);
box->setStretchFactor(new QWidget(box), 1); // left adjust the controls
layout->addWidget(mTemplateTime);
layout->setStretchFactor(new QWidget(box), 1); // left adjust the controls
box->setFixedHeight(box->sizeHint().height());
grid->addWidget(box, 0, 1, Qt::AlignLeft);
......@@ -344,23 +356,25 @@ void EditAlarmDlg::init(const KAEvent* event)
mTemplateTimeGroup->addButton(mTemplateAnyTime);
grid->addWidget(mTemplateAnyTime, 1, 0, Qt::AlignLeft);
box = new KHBox(templateTimeBox);
box->setMargin(0);
box->setSpacing(spacingHint());
layout = new QHBoxLayout(templateTimeBox);
layout->setMargin(0);
layout->setSpacing(spacingHint());
mTemplateUseTimeAfter = new RadioButton(i18nc("@option:radio", "Time from now:"), box);
mTemplateUseTimeAfter->setFixedSize(mTemplateUseTimeAfter->sizeHint());
mTemplateUseTimeAfter->setReadOnly(mReadOnly);
mTemplateUseTimeAfter->setWhatsThis(i18nc("@info:whatsthis",
"Set alarms based on this template to start after the specified time "
"interval from when the alarm is created."));
layout->addWidget(mTemplateUseTimeAfter);
mTemplateTimeGroup->addButton(mTemplateUseTimeAfter);
mTemplateTimeAfter = new TimeSpinBox(1, maxDelayTime, box);
mTemplateTimeAfter = new TimeSpinBox(1, maxDelayTime);
mTemplateTimeAfter->setValue(1439);
mTemplateTimeAfter->setFixedSize(mTemplateTimeAfter->sizeHint());
mTemplateTimeAfter->setReadOnly(mReadOnly);
connect(mTemplateTimeAfter, static_cast<void (TimeSpinBox::*)(int)>(&TimeSpinBox::valueChanged), this, &EditAlarmDlg::contentsChanged);
mTemplateTimeAfter->setWhatsThis(xi18nc("@info:whatsthis", "<para>%1</para><para>%2</para>",
AlarmTimeWidget::i18n_TimeAfterPeriod(), TimeSpinBox::shiftWhatsThis()));
layout->addWidget(mTemplateTimeAfter);
box->setFixedHeight(box->sizeHint().height());
grid->addWidget(box, 1, 1, Qt::AlignLeft);
......
......@@ -58,6 +58,7 @@ using namespace KCalCore;
#include <kiconloader.h>
#include <kfileitem.h>
#include <QComboBox>
#include <QLabel>
#include <QDir>
#include <QStyle>
......@@ -1143,7 +1144,7 @@ void EditEmailAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
label->setFixedSize(label->sizeHint());
grid->addWidget(label, 0, 0);
mEmailAttachList = new KComboBox(parent);
mEmailAttachList = new QComboBox(parent);
mEmailAttachList->setEditable(true);
mEmailAttachList->setMinimumSize(mEmailAttachList->sizeHint());
if (mEmailAttachList->lineEdit())
......
......@@ -31,7 +31,7 @@
class QAbstractButton;
class QGroupBox;
class KComboBox;
class QComboBox;
class EmailIdCombo;
class CheckBox;
class ComboBox;
......@@ -238,7 +238,7 @@ class EditEmailAlarmDlg : public EditAlarmDlg
QPushButton* mEmailAddressButton; // email open address book button
LineEdit* mEmailSubjectEdit;
TextEdit* mEmailMessageEdit; // email body edit box
KComboBox* mEmailAttachList;
QComboBox* mEmailAttachList;
QPushButton* mEmailAddAttachButton;
QPushButton* mEmailRemoveButton;
CheckBox* mEmailBcc;
......
......@@ -24,8 +24,8 @@
#include "checkbox.h"
#include "fontcolour.h"
#include <kdialog.h>
#include <kfontchooser.h>
#include <kfontdialog.h>
#include <QGroupBox>
#include <QPushButton>
......
......@@ -26,7 +26,6 @@
#include "preferences.h"
#include "pushbutton.h"
#include <klineedit.h>
#include <KLocalizedString>
#include <QVBoxLayout>
......
......@@ -51,10 +51,8 @@
#include <kfileitem.h>
#include <kstandardguiitem.h>
#include <kservicetypetrader.h>
#include <ktoolinvocation.h>
#include <netwm.h>
#include <kshell.h>
#include <ksystemtrayicon.h>
#include <ksystemtimezone.h>
#include <QObject>
......@@ -63,6 +61,7 @@
#include <QTextStream>
#include <QtDBus/QtDBus>
#include <QStandardPaths>
#include <QSystemTrayIcon>
#include "kalarm_debug.h"
#include <stdlib.h>
......@@ -486,7 +485,7 @@ int KAlarmApp::newInstance()
case CommandOptions::TRAY:
// Display only the system tray icon
if (Preferences::showInSystemTray() && KSystemTrayIcon::isSystemTrayAvailable())
if (Preferences::showInSystemTray() && QSystemTrayIcon::isSystemTrayAvailable())
{
if (!initCheck() // open the calendar, start processing execution queue
|| !displayTrayIcon(true))
......@@ -936,7 +935,7 @@ bool KAlarmApp::displayTrayIcon(bool show, MainWindow* parent)
{
if (!mTrayWindow && !creating)
{
if (!KSystemTrayIcon::isSystemTrayAvailable())
if (!QSystemTrayIcon::isSystemTrayAvailable())
return false;
if (!MainWindow::count())
{
......@@ -970,7 +969,7 @@ bool KAlarmApp::checkSystemTray()
{
if (!mTrayWindow)
return true;
if (KSystemTrayIcon::isSystemTrayAvailable() == mNoSystemTray)
if (QSystemTrayIcon::isSystemTrayAvailable() == mNoSystemTray)
{
qCDebug(KALARM_LOG) << "changed ->" << mNoSystemTray;
mNoSystemTray = !mNoSystemTray;
......@@ -1093,7 +1092,7 @@ void KAlarmApp::slotFeb29TypeChanged(Preferences::Feb29Type type)
*/
bool KAlarmApp::wantShowInSystemTray() const
{
return Preferences::showInSystemTray() && KSystemTrayIcon::isSystemTrayAvailable();
return Preferences::showInSystemTray() && QSystemTrayIcon::isSystemTrayAvailable();
}
/******************************************************************************
......
......@@ -46,7 +46,7 @@ class ButtonGroup : public QButtonGroup
/** Constructor.
* @param parent The parent object of this widget
*/
explicit ButtonGroup(QObject* parent);
explicit ButtonGroup(QObject* parent = Q_NULLPTR);
/** Adds a button to the group.
* The button is not given an ID.
* This overrides the addButton() method of QButtonGroup.
......
......@@ -23,15 +23,13 @@
ItemBox::ItemBox(QWidget* parent)
: KHBox(parent)
: QHBoxLayout(parent)
{
mLayout = qobject_cast<QHBoxLayout*>(layout());
Q_ASSERT(mLayout);
}
void ItemBox::leftAlign()
{
mLayout->addStretch();
addStretch();
}
// vim: et sw=4:
......@@ -21,16 +21,14 @@
#ifndef ITEMBOX_H
#define ITEMBOX_H
#include <khbox.h>
class QHBoxLayout;
#include <QHBoxLayout>
/**
* @short A KHBox with left-adjustment
* @short A QHBoxLayout with left-adjustment
*
* @author David Jarvie <djarvie@kde.org>
*/
class ItemBox : public KHBox
class ItemBox : public QHBoxLayout
{
Q_OBJECT
public:
......@@ -39,9 +37,6 @@ class ItemBox : public KHBox
*/
explicit ItemBox(QWidget* parent = Q_NULLPTR);
void leftAlign();
private:
QHBoxLayout* mLayout;
};
#endif // ITEMBOX_H
......
......@@ -21,7 +21,7 @@
#include "kalarm.h" //krazy:exclude=includes (kalarm.h must be first)
#include "kalocale.h"
#include <kglobal.h>
#include <KLocale>
#include <KLocalizedString>
#include "kalarm_debug.h"
#include <QLocale>
......@@ -49,19 +49,7 @@ int localeFirstDayOfWeek()
*/
QString weekDayName(int day, const KLocale* locale)
{
#if 0 //QT5
switch (day)
{
case Qt::Monday: return ki18nc("@option Name of the weekday", "Monday").toString(locale);
case Qt::Tuesday: return ki18nc("@option Name of the weekday", "Tuesday").toString(locale);
case Qt::Wednesday: return ki18nc("@option Name of the weekday", "Wednesday").toString(locale);
case Qt::Thursday: return ki18nc("@option Name of the weekday", "Thursday").toString(locale);
case Qt::Friday: return ki18nc("@option Name of the weekday", "Friday").toString(locale);
case Qt::Saturday: return ki18nc("@option Name of the weekday", "Saturday").toString(locale);
case Qt::Sunday: return ki18nc("@option Name of the weekday", "Sunday").toString(locale);
}
#endif
return QString();
return QLocale().dayName(day);
}
/******************************************************************************
......
......@@ -48,12 +48,12 @@ class RadioButton : public QRadioButton
/** Constructor.
* @param parent The parent object of this widget.
*/
explicit RadioButton(QWidget* parent);
explicit RadioButton(QWidget* parent = Q_NULLPTR);
/** Constructor.
* @param text Text to display.
* @param parent The parent object of this widget.
*/
RadioButton(const QString& text, QWidget* parent);
RadioButton(const QString& text, QWidget* parent = Q_NULLPTR);
/** Returns true if the widget is read only. */
bool isReadOnly() const { return mReadOnly; }
/** Sets whether the radio button is read-only for the user. If read-only,
......
......@@ -21,7 +21,6 @@
#include "shellprocess.h"
#include <kde_file.h>
#include <kapplication.h>
#include <KLocalizedString>
#include "kalarm_debug.h"
#include <kauthorized.h>
......
......@@ -24,7 +24,7 @@
#include "timespinbox.h"
#include "timeedit.h"
#include <kglobal.h>
#include <KLocale>
#include <KLocalizedString>
#include <QHBoxLayout>
......
......@@ -20,7 +20,6 @@
#include "timezonecombo.h"
#include <ksystemtimezone.h>
#include <kglobal.h>
#include <KLocalizedString>
......
......@@ -56,7 +56,6 @@
#include <KJobWidgets>
#include <knotification.h>
#include <ksqueezedtextlabel.h>
#include <ktoolinvocation.h>
#include <phonon/mediaobject.h>
#include <phonon/audiooutput.h>
#include <phonon/volumefadereffect.h>
......
This diff is collapsed.
Markdown is supported
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