Commit 5ffefef2 authored by David Jarvie's avatar David Jarvie
Browse files

Use C++14; spacing.

parent 4ed634ac
Pipeline #100735 failed with stage
in 10 minutes and 56 seconds
......@@ -35,36 +35,35 @@ class ItemDeleteJob;
=============================================================================*/
class AkonadiCollectionSearch : public QObject
{
Q_OBJECT
public:
explicit AkonadiCollectionSearch(const QString& mimeType, const QString& gid = QString(), const QString& uid = QString(), bool remove = false);
Q_OBJECT
public:
explicit AkonadiCollectionSearch(const QString& mimeType, const QString& gid = QString(), const QString& uid = QString(), bool remove = false);
Q_SIGNALS:
// Signal emitted if action is to fetch all collections for the mime type
void collections(const Akonadi::Collection::List&);
// Signal emitted if action is to fetch all items with the remote ID
void items(const Akonadi::Item::List&);
// Signal emitted if action is to delete all items with the remote ID
void deleted(int count);
Q_SIGNALS:
// Signal emitted if action is to fetch all collections for the mime type
void collections(const Akonadi::Collection::List&);
// Signal emitted if action is to fetch all items with the remote ID
void items(const Akonadi::Item::List&);
// Signal emitted if action is to delete all items with the remote ID
void deleted(int count);
private Q_SLOTS:
void collectionFetchResult(KJob*);
void itemFetchResult(KJob*);
void itemDeleteResult(KJob*);
void finish();
private Q_SLOTS:
void collectionFetchResult(KJob*);
void itemFetchResult(KJob*);
void itemDeleteResult(KJob*);
void finish();
private:
QString mMimeType;
QString mGid;
QString mUid;
QList<Akonadi::CollectionFetchJob*> mCollectionJobs;
QMap<Akonadi::ItemFetchJob*, Akonadi::Collection::Id> mItemFetchJobs;
QMap<Akonadi::ItemDeleteJob*, Akonadi::Collection::Id> mItemDeleteJobs;
Akonadi::Collection::List mCollections;
Akonadi::Item::List mItems;
int mDeleteCount {0};
bool mDelete;
private:
QString mMimeType;
QString mGid;
QString mUid;
QList<Akonadi::CollectionFetchJob*> mCollectionJobs;
QMap<Akonadi::ItemFetchJob*, Akonadi::Collection::Id> mItemFetchJobs;
QMap<Akonadi::ItemDeleteJob*, Akonadi::Collection::Id> mItemDeleteJobs;
Akonadi::Collection::List mCollections;
Akonadi::Item::List mItems;
int mDeleteCount {0};
bool mDelete;
};
// vim: et sw=4:
......@@ -25,5 +25,4 @@ private:
QRect textRect(const QString& text, QPainter*, const QStyleOptionViewItem&) const;
};
// vim: et sw=4:
......@@ -43,5 +43,4 @@ private:
QByteArray mConfigGroup;
};
// vim: et sw=4:
......@@ -274,7 +274,7 @@ KADateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, boo
KAMessageBox::sorry(const_cast<AlarmTimeWidget*>(this), i18nc("@info", "Invalid time"));
if (errorWidget)
*errorWidget = mDelayTimeEdit;
return KADateTime();
return {};
}
const int delayMins = mDelayTimeEdit->value();
if (minsFromNow)
......@@ -302,7 +302,7 @@ KADateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, boo
if (errorWidget)
*errorWidget = mTimeEdit;
}
return KADateTime();
return {};
}
KADateTime result;
......@@ -315,7 +315,7 @@ KADateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, boo
KAMessageBox::sorry(const_cast<AlarmTimeWidget*>(this), i18nc("@info", "Alarm date has already expired"));
if (errorWidget)
*errorWidget = mDateEdit;
return KADateTime();
return {};
}
}
else
......@@ -327,7 +327,7 @@ KADateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, boo
KAMessageBox::sorry(const_cast<AlarmTimeWidget*>(this), i18nc("@info", "Alarm time has already expired"));
if (errorWidget)
*errorWidget = mTimeEdit;
return KADateTime();
return {};
}
}
return result;
......
......@@ -27,77 +27,76 @@ using namespace KAlarmCal;
class AlarmTimeWidget : public QFrame
{
Q_OBJECT
public:
enum Mode { // 'mode' values for constructor
AT_TIME = 0x01, // "At ..."
DEFER_TIME = 0x02, // "Defer to ..."
DEFER_ANY_TIME = DEFER_TIME | 0x04 // "Defer to ..." with 'any time' option
};
AlarmTimeWidget(const QString& groupBoxTitle, Mode, QWidget* parent = nullptr);
explicit AlarmTimeWidget(Mode, QWidget* parent = nullptr);
KADateTime getDateTime(int* minsFromNow = nullptr, bool checkExpired = true, bool showErrorMessage = true, QWidget** errorWidget = nullptr) const;
void setDateTime(const DateTime&);
void setMinDateTimeIsCurrent();
void setMinDateTime(const KADateTime& = KADateTime());
void setMaxDateTime(const DateTime& = DateTime());
const KADateTime& maxDateTime() const { return mMaxDateTime; }
KADateTime::Spec timeSpec() const { return mTimeSpec; }
void setReadOnly(bool);
bool anyTime() const { return mAnyTime; }
void enableAnyTime(bool enable);
/** Select/deselect 'Time from now' option.
* @param minutes Value to set in 'Time from now', or
* if < 0, select 'At date/time' option.
*/
void selectTimeFromNow(int minutes = 0);
void showMoreOptions(bool);
QSize sizeHint() const override { return minimumSizeHint(); }
Q_OBJECT
public:
enum Mode { // 'mode' values for constructor
AT_TIME = 0x01, // "At ..."
DEFER_TIME = 0x02, // "Defer to ..."
DEFER_ANY_TIME = DEFER_TIME | 0x04 // "Defer to ..." with 'any time' option
};
AlarmTimeWidget(const QString& groupBoxTitle, Mode, QWidget* parent = nullptr);
explicit AlarmTimeWidget(Mode, QWidget* parent = nullptr);
KADateTime getDateTime(int* minsFromNow = nullptr, bool checkExpired = true, bool showErrorMessage = true, QWidget** errorWidget = nullptr) const;
void setDateTime(const DateTime&);
void setMinDateTimeIsCurrent();
void setMinDateTime(const KADateTime& = KADateTime());
void setMaxDateTime(const DateTime& = DateTime());
const KADateTime& maxDateTime() const { return mMaxDateTime; }
KADateTime::Spec timeSpec() const { return mTimeSpec; }
void setReadOnly(bool);
bool anyTime() const { return mAnyTime; }
void enableAnyTime(bool enable);
/** Select/deselect 'Time from now' option.
* @param minutes Value to set in 'Time from now', or
* if < 0, select 'At date/time' option.
*/
void selectTimeFromNow(int minutes = 0);
void showMoreOptions(bool);
QSize sizeHint() const override { return minimumSizeHint(); }
static QString i18n_TimeAfterPeriod();
static const int maxDelayTime; // maximum time from now
static QString i18n_TimeAfterPeriod();
static const int maxDelayTime; // maximum time from now
Q_SIGNALS:
void changed(const KAlarmCal::KADateTime&);
void dateOnlyToggled(bool anyTime);
void pastMax();
Q_SIGNALS:
void changed(const KAlarmCal::KADateTime&);
void dateOnlyToggled(bool anyTime);
void pastMax();
private Q_SLOTS:
void updateTimes();
void slotButtonSet(QAbstractButton*);
void dateTimeChanged();
void delayTimeChanged(int);
void slotAnyTimeToggled(bool);
void slotTimeZoneChanged();
void showTimeZoneSelector();
private Q_SLOTS:
void updateTimes();
void slotButtonSet(QAbstractButton*);
void dateTimeChanged();
void delayTimeChanged(int);
void slotAnyTimeToggled(bool);
void slotTimeZoneChanged();
void showTimeZoneSelector();
private:
void init(Mode, const QString& groupBoxTitle = QString());
void setAnyTime();
void setMaxDelayTime(const KADateTime& now);
void setMaxMinTimeIf(const KADateTime& now);
private:
void init(Mode, const QString& groupBoxTitle = QString());
void setAnyTime();
void setMaxDelayTime(const KADateTime& now);
void setMaxMinTimeIf(const KADateTime& now);
ButtonGroup* mButtonGroup;
RadioButton* mAtTimeRadio;
RadioButton* mAfterTimeRadio;
CheckBox* mAnyTimeCheckBox;
KDateComboBox* mDateEdit;
TimeEdit* mTimeEdit;
TimeSpinBox* mDelayTimeEdit;
PushButton* mTimeZoneButton;
QWidget* mTimeZoneBox; // contains label and time zone combo box
TimeZoneCombo* mTimeZone;
KADateTime mMinDateTime; // earliest allowed date/time
KADateTime mMaxDateTime; // latest allowed date/time
KADateTime::Spec mTimeSpec; // time spec used
int mAnyTime; // 0 = date/time is specified, 1 = only a date, -1 = uninitialised
bool mAnyTimeAllowed; // 'mAnyTimeCheckBox' is enabled
bool mDeferring; // being used to enter a deferral time
bool mMinDateTimeIsNow {false}; // earliest allowed date/time is the current time
bool mPastMax {false}; // current time is past the maximum date/time
bool mMinMaxTimeSet {false}; // limits have been set for the time edit control
bool mTimerSyncing; // mTimer is not yet synchronized to the minute boundary
ButtonGroup* mButtonGroup;
RadioButton* mAtTimeRadio;
RadioButton* mAfterTimeRadio;
CheckBox* mAnyTimeCheckBox;
KDateComboBox* mDateEdit;
TimeEdit* mTimeEdit;
TimeSpinBox* mDelayTimeEdit;
PushButton* mTimeZoneButton;
QWidget* mTimeZoneBox; // contains label and time zone combo box
TimeZoneCombo* mTimeZone;
KADateTime mMinDateTime; // earliest allowed date/time
KADateTime mMaxDateTime; // latest allowed date/time
KADateTime::Spec mTimeSpec; // time spec used
int mAnyTime; // 0 = date/time is specified, 1 = only a date, -1 = uninitialised
bool mAnyTimeAllowed; // 'mAnyTimeCheckBox' is enabled
bool mDeferring; // being used to enter a deferral time
bool mMinDateTimeIsNow {false}; // earliest allowed date/time is the current time
bool mPastMax {false}; // current time is past the maximum date/time
bool mMinMaxTimeSet {false}; // limits have been set for the time edit control
bool mTimerSyncing; // mTimer is not yet synchronized to the minute boundary
};
// vim: et sw=4:
......@@ -12,19 +12,18 @@
class AutostartApp : public QCoreApplication
{
Q_OBJECT
public:
AutostartApp(int& argc, char** argv);
~AutostartApp() override {}
void setCommandLine(const QString& exe, const QStringList& args);
Q_OBJECT
public:
AutostartApp(int& argc, char** argv);
~AutostartApp() override = default;
void setCommandLine(const QString& exe, const QStringList& args);
private Q_SLOTS:
void slotAutostart();
private Q_SLOTS:
void slotAutostart();
private:
QString mExecutable;
QStringList mArgs;
private:
QString mExecutable;
QStringList mArgs;
};
// vim: et sw=4:
......@@ -80,5 +80,4 @@ protected:
void focusOutEvent(QFocusEvent*) override { Q_EMIT focusLost(); }
};
// vim: et sw=4:
......@@ -25,50 +25,49 @@ namespace Akonadi
*/
class BirthdayModel : public Akonadi::ContactsTreeModel
{
Q_OBJECT
public:
enum { // data columns
NameColumn, DateColumn,
ColumnCount
};
/**
* Destroys the global contact model.
*/
~BirthdayModel() override;
/**
* Returns the global contact model instance.
*/
static BirthdayModel* instance();
QVariant entityData(const Akonadi::Item&, int column, int role = Qt::DisplayRole) const override;
QVariant entityData(const Akonadi::Collection& collection, int column, int role = Qt::DisplayRole) const override
{ return Akonadi::ContactsTreeModel::entityData(collection, column, role); }
private:
explicit BirthdayModel(Akonadi::ChangeRecorder* recorder);
static BirthdayModel* mInstance;
Q_OBJECT
public:
enum { // data columns
NameColumn, DateColumn,
ColumnCount
};
/**
* Destroys the global contact model.
*/
~BirthdayModel() override;
/**
* Returns the global contact model instance.
*/
static BirthdayModel* instance();
QVariant entityData(const Akonadi::Item&, int column, int role = Qt::DisplayRole) const override;
QVariant entityData(const Akonadi::Collection& collection, int column, int role = Qt::DisplayRole) const override
{ return Akonadi::ContactsTreeModel::entityData(collection, column, role); }
private:
explicit BirthdayModel(Akonadi::ChangeRecorder* recorder);
static BirthdayModel* mInstance;
};
class BirthdaySortModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit BirthdaySortModel(QObject* parent = nullptr);
Q_OBJECT
public:
explicit BirthdaySortModel(QObject* parent = nullptr);
void setPrefixSuffix(const QString& prefix, const QString& suffix);
void setPrefixSuffix(const QString& prefix, const QString& suffix);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
private:
QStringList mContactsWithAlarm;
QString mPrefix;
QString mSuffix;
private:
QStringList mContactsWithAlarm;
QString mPrefix;
QString mSuffix;
};
// vim: et sw=4:
......@@ -776,7 +776,7 @@ QString CommandOptions::optionName(Option opt, bool shortName) const
return QStringLiteral("message");
const QStringList names = mOptions.at(opt)->names();
if (names.empty())
return QString();
return {};
for (const QString& name : names)
{
if (shortName && name.size() == 1)
......
......@@ -171,5 +171,4 @@ private:
#endif
};
// vim: et sw=4:
......@@ -70,5 +70,4 @@ private:
QDate mStartDate; // earliest date currently displayed
};
// vim: et sw=4:
......@@ -270,7 +270,7 @@ void DayMatrix::updateEvents()
QString DayMatrix::getHolidayLabel(int offset) const
{
if (offset < 0 || offset > NUMDAYS - 1)
return QString();
return {};
return mHolidays[offset];
}
......
......@@ -127,5 +127,4 @@ private:
bool mPendingChanges {false}; // the display needs to be updated
};
// vim: et sw=4:
......@@ -151,5 +151,4 @@ private:
static bool convertRecurrence(KARecurrence&, const KADateTime& start, int recurType, int recurInterval, int recurCount, const KADateTime& end);
};
// vim: et sw=4:
......@@ -23,30 +23,29 @@ using namespace KAlarmCal;
class DeferAlarmDlg : public QDialog
{
Q_OBJECT
public:
DeferAlarmDlg(const DateTime& initialDT, bool anyTimeOption, bool cancelButton, QWidget* parent = nullptr);
void setLimit(const DateTime&);
DateTime setLimit(const KAEvent& event);
const DateTime& getDateTime() const { return mAlarmDateTime; }
void setDeferMinutes(int mins);
int deferMinutes() const { return mDeferMinutes; }
protected Q_SLOTS:
virtual void slotOk();
virtual void slotCancelDeferral();
private Q_SLOTS:
void slotPastLimit();
private:
AlarmTimeWidget* mTimeWidget;
QDialogButtonBox* mButtonBox;
DateTime mAlarmDateTime;
DateTime mLimitDateTime; // latest date/time allowed for deferral
EventId mLimitEventId; // event IDs from whose recurrences to derive the limit date/time for deferral
int mDeferMinutes; // number of minutes deferral selected, or 0 if date/time entered
Q_OBJECT
public:
DeferAlarmDlg(const DateTime& initialDT, bool anyTimeOption, bool cancelButton, QWidget* parent = nullptr);
void setLimit(const DateTime&);
DateTime setLimit(const KAEvent& event);
const DateTime& getDateTime() const { return mAlarmDateTime; }
void setDeferMinutes(int mins);
int deferMinutes() const { return mDeferMinutes; }
protected Q_SLOTS:
virtual void slotOk();
virtual void slotCancelDeferral();
private Q_SLOTS:
void slotPastLimit();
private:
AlarmTimeWidget* mTimeWidget;
QDialogButtonBox* mButtonBox;
DateTime mAlarmDateTime;
DateTime mLimitDateTime; // latest date/time allowed for deferral
EventId mLimitEventId; // event IDs from whose recurrences to derive the limit date/time for deferral
int mDeferMinutes; // number of minutes deferral selected, or 0 if date/time entered
};
// vim: et sw=4:
......@@ -347,7 +347,7 @@ bool DisplayCalendar::deleteEvent(const QString& eventID, bool saveit)
KCalendarCore::Event::Ptr DisplayCalendar::kcalEvent(const QString& uniqueID)
{
if (!mCalendarStorage)
return KCalendarCore::Event::Ptr();
return {};
return mCalendarStorage->calendar()->event(uniqueID);
}
......
......@@ -56,5 +56,4 @@ private:
static bool mOpen; // true if the calendar file is open
};
// vim: et sw=4:
......@@ -216,5 +216,4 @@ private:
bool mSavedShowInKorganizer; // mShowInKorganizer status
};
// vim: et sw=4:
......@@ -18,61 +18,60 @@ class LineEdit;
class PageFrame : public QFrame
{
Q_OBJECT
public:
explicit PageFrame(QWidget* parent = nullptr) : QFrame(parent) { }
Q_OBJECT
public:
explicit PageFrame(QWidget* parent = nullptr) : QFrame(parent) { }
protected:
void showEvent(QShowEvent*) override { Q_EMIT shown(); }
protected:
void showEvent(QShowEvent*) override { Q_EMIT shown(); }
Q_SIGNALS:
void shown();
Q_SIGNALS:
void shown();
};
class TextEdit : public KTextEdit
{
Q_OBJECT
public:
explicit TextEdit(QWidget* parent);
void enableEmailDrop();
QSize sizeHint() const override { return minimumSizeHint(); }
QSize minimumSizeHint() const override { return minimumSize(); }
Q_OBJECT
public:
explicit TextEdit(QWidget* parent);
void enableEmailDrop();
QSize sizeHint() const override { return minimumSizeHint(); }
QSize minimumSizeHint() const override { return minimumSize(); }
protected:
void dragEnterEvent(QDragEnterEvent*) override;
void dragMoveEvent(QDragMoveEvent*) override;
void dropEvent(QDropEvent*) override;
protected:
void dragEnterEvent(QDragEnterEvent*) override;
void dragMoveEvent(QDragMoveEvent*) override;
void dropEvent(QDropEvent*) override;
private:
bool mEmailDrop {false};
private:
bool mEmailDrop {false};
};
class CommandEdit : public QWidget
{
Q_OBJECT
public:
explicit CommandEdit(QWidget* parent);
bool isScript() const;
void setScript(bool);
QString text() const;
QString text(EditAlarmDlg*, bool showErrorMessage) const;
void setText(const AlarmText&);
void setReadOnly(bool);
QSize minimumSizeHint() const override;
QSize sizeHint() const override { return minimumSizeHint(); }
Q_OBJECT
public:
explicit CommandEdit(QWidget* parent);
bool isScript() const;
void setScript(bool);
QString text() const;
QString text(EditAlarmDlg*, bool showErrorMessage) const;
void setText(const AlarmText&);
void setReadOnly(bool);
QSize minimumSizeHint() const override;
QSize sizeHint() const override { return minimumSizeHint(); }
Q_SIGNALS:
void scriptToggled(bool);
void changed(); // emitted when any changes occur
Q_SIGNALS:
void scriptToggled(bool);
void changed(); // emitted when any changes occur
private Q_SLOTS:
void slotCmdScriptToggled(bool);
private Q_SLOTS:
void slotCmdScriptToggled(bool);
private:
CheckBox* mTypeScript; // entering a script
LineEdit* mCommandEdit; // command line edit box
TextEdit* mScriptEdit; // script edit box
private:
CheckBox* mTypeScript; // entering a script
LineEdit* mCommandEdit; // command line edit box
TextEdit* mScriptEdit; // script edit box
};
// vim: et sw=4:
......@@ -302,5 +302,4 @@ private: