Commit 1a1add32 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

GIT_SILENT: coding style

parent 3e8a4ebb
This diff is collapsed.
......@@ -36,14 +36,11 @@
#include <QFrame>
#include <QScrollArea>
namespace Akonadi
{
namespace Akonadi {
class IncidenceChanger;
}
namespace EventViews
{
namespace EventViews {
class Agenda;
class AgendaItem;
class AgendaView;
......@@ -68,8 +65,8 @@ class EVENTVIEWS_EXPORT Agenda : public QWidget
{
Q_OBJECT
public:
Agenda(AgendaView *agendaView, QScrollArea *scrollArea,
int columns, int rows, int rowSize, bool isInteractive);
Agenda(AgendaView *agendaView, QScrollArea *scrollArea, int columns, int rows, int rowSize,
bool isInteractive);
Agenda(AgendaView *agendaView, QScrollArea *scrollArea, int columns, bool isInteractive);
......@@ -123,14 +120,16 @@ public:
void setStartTime(const QTime &startHour);
AgendaItem::QPtr insertItem(const KCalCore::Incidence::Ptr &incidence, const QDateTime &recurrenceId, int X, int YTop,
int YBottom, int itemPos, int itemCount, bool isSelected);
AgendaItem::QPtr insertItem(const KCalCore::Incidence::Ptr &incidence,
const QDateTime &recurrenceId, int X, int YTop, int YBottom,
int itemPos, int itemCount, bool isSelected);
AgendaItem::QPtr insertAllDayItem(const KCalCore::Incidence::Ptr &event, const QDateTime &recurrenceId, int XBegin,
int XEnd, bool isSelected);
AgendaItem::QPtr insertAllDayItem(const KCalCore::Incidence::Ptr &event,
const QDateTime &recurrenceId, int XBegin, int XEnd,
bool isSelected);
void insertMultiItem(const KCalCore::Incidence::Ptr &event, const QDateTime &recurrenceId, int XBegin, int XEnd,
int YTop, int YBottom, bool isSelected);
void insertMultiItem(const KCalCore::Incidence::Ptr &event, const QDateTime &recurrenceId,
int XBegin, int XEnd, int YTop, int YBottom, bool isSelected);
/**
Removes an event and all its multi-items from the agenda. This function
......@@ -271,7 +270,8 @@ protected:
@param pos The current mouse position
@param item The affected item
*/
MouseActionType isInResizeArea(bool horizontal, const QPoint &pos, const AgendaItem::QPtr &item);
MouseActionType isInResizeArea(bool horizontal, const QPoint &pos,
const AgendaItem::QPtr &item);
/** Return whether the cell specified by the grid point belongs to the current select
*/
bool ptInSelection(const QPoint &gpos) const;
......@@ -351,10 +351,7 @@ public:
private:
Agenda *mAgenda = nullptr;
};
}
#endif
This diff is collapsed.
......@@ -34,9 +34,7 @@
#include <QWidget>
#include <QPointer>
namespace EventViews
{
namespace EventViews {
class AgendaItem;
class EventView;
......@@ -83,14 +81,9 @@ public:
typedef QPointer<AgendaItem> QPtr;
typedef QList<QPtr> List;
AgendaItem(EventView *eventView,
const MultiViewCalendar::Ptr &calendar,
const KCalCore::Incidence::Ptr &incidence,
int itemPos,
int itemCount,
const QDateTime &qd,
bool isSelected,
QWidget *parent);
AgendaItem(EventView *eventView, const MultiViewCalendar::Ptr &calendar,
const KCalCore::Incidence::Ptr &incidence, int itemPos, int itemCount,
const QDateTime &qd, bool isSelected, QWidget *parent);
~AgendaItem();
int cellXLeft() const
......@@ -286,8 +279,7 @@ private:
// paint all visible icons
void paintIcons(QPainter *p, int &x, int y, int ft);
void drawRoundedRect(QPainter *p, const QRect &rect,
bool selected, const QColor &bgcolor,
void drawRoundedRect(QPainter *p, const QRect &rect, bool selected, const QColor &bgcolor,
bool frame, int ft, bool roundTop, bool roundBottom);
int mCellXLeft, mCellXRight;
......@@ -326,7 +318,6 @@ private:
static QPixmap *todoPxmp;
static QPixmap *completedPxmp;
};
}
#endif
This diff is collapsed.
......@@ -38,12 +38,9 @@ class KConfig;
class QSplitter;
namespace EventViews
{
namespace EventViews {
#ifndef EVENTVIEWS_NODECOS
namespace CalendarDecoration
{
namespace CalendarDecoration {
class Decoration;
}
#endif
......@@ -87,18 +84,11 @@ class EVENTVIEWS_EXPORT AgendaView : public EventView
{
Q_OBJECT
public:
explicit AgendaView(const PrefsPtr &preferences,
const QDate &start,
const QDate &end,
bool isInteractive,
bool isSideBySide = false,
QWidget *parent = nullptr);
explicit AgendaView(const QDate &start,
const QDate &end,
bool isInteractive,
bool isSideBySide = false,
QWidget *parent = nullptr);
explicit AgendaView(const PrefsPtr &preferences, const QDate &start, const QDate &end,
bool isInteractive, bool isSideBySide = false, QWidget *parent = nullptr);
explicit AgendaView(const QDate &start, const QDate &end, bool isInteractive,
bool isSideBySide = false, QWidget *parent = nullptr);
virtual ~AgendaView();
......@@ -116,8 +106,7 @@ public:
KCalCore::DateList selectedIncidenceDates() const override;
/** return the default start/end date/time for new events */
virtual bool eventDurationHint(QDateTime &startDt,
QDateTime &endDt,
virtual bool eventDurationHint(QDateTime &startDt, QDateTime &endDt,
bool &allDay) const override;
/** start-datetime of selection */
......@@ -227,8 +216,7 @@ public Q_SLOTS:
void updateConfig() override;
/** reschedule the todo to the given x- and y- coordinates.
Third parameter determines all-day (no time specified) */
void slotIncidencesDropped(const KCalCore::Incidence::List &incidences,
const QPoint &, bool);
void slotIncidencesDropped(const KCalCore::Incidence::List &incidences, const QPoint &, bool);
void slotIncidencesDropped(const QList<QUrl> &incidences, const QPoint &, bool);
void startDrag(const KCalCore::Incidence::Ptr &);
......@@ -259,7 +247,7 @@ private Q_SLOTS:
private:
void init(const QDate &start, const QDate &end);
bool filterByCollectionSelection(const KCalCore::Incidence::Ptr &incidence);
bool filterByCollectionSelection(const KCalCore::Incidence::Ptr &incidence);
void setupTimeLabel(TimeLabels *timeLabel);
bool displayIncidence(const KCalCore::Incidence::Ptr &incidence, bool createSelected);
......@@ -267,7 +255,8 @@ private:
typedef QList<EventViews::CalendarDecoration::Decoration *> DecorationList;
bool loadDecorations(const QStringList &decorations, DecorationList &decoList);
void placeDecorationsFrame(QFrame *frame, bool decorationsFound, bool isTop);
void placeDecorations(EventViews::AgendaView::DecorationList &decoList, const QDate &date, QWidget *labelBox, bool forWeek);
void placeDecorations(EventViews::AgendaView::DecorationList &decoList, const QDate &date,
QWidget *labelBox, bool forWeek);
#endif
friend class TimeLabelsZone;
......@@ -278,7 +267,6 @@ private:
class Private;
Private *const d;
};
}
#endif
......@@ -26,8 +26,11 @@ using namespace EventViews;
AlternateLabel::AlternateLabel(const QString &shortlabel, const QString &longlabel,
const QString &extensivelabel, QWidget *parent)
: QLabel(parent), mTextTypeFixed(false), mShortText(shortlabel),
mLongText(longlabel), mExtensiveText(extensivelabel)
: QLabel(parent)
, mTextTypeFixed(false)
, mShortText(shortlabel)
, mLongText(longlabel)
, mExtensiveText(extensivelabel)
{
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
if (mExtensiveText.isEmpty()) {
......
......@@ -25,9 +25,7 @@
#include <QLabel>
namespace EventViews
{
namespace EventViews {
class AlternateLabel : public QLabel
{
Q_OBJECT
......@@ -60,7 +58,6 @@ protected:
private:
int getIndent() const;
};
}
#endif
......@@ -73,26 +73,30 @@ StoredElement::StoredElement(const QString &id) : Element(id)
}
StoredElement::StoredElement(const QString &id, const QString &shortText)
: Element(id), mShortText(shortText)
: Element(id)
, mShortText(shortText)
{
}
StoredElement::StoredElement(const QString &id, const QString &shortText,
const QString &longText)
: Element(id), mShortText(shortText), mLongText(longText)
StoredElement::StoredElement(const QString &id, const QString &shortText, const QString &longText)
: Element(id)
, mShortText(shortText)
, mLongText(longText)
{
}
StoredElement::StoredElement(const QString &id, const QString &shortText,
const QString &longText,
StoredElement::StoredElement(const QString &id, const QString &shortText, const QString &longText,
const QString &extensiveText)
: Element(id), mShortText(shortText), mLongText(longText),
mExtensiveText(extensiveText)
: Element(id)
, mShortText(shortText)
, mLongText(longText)
, mExtensiveText(extensiveText)
{
}
StoredElement::StoredElement(const QString &id, const QPixmap &pixmap)
: Element(id), mPixmap(pixmap)
: Element(id)
, mPixmap(pixmap)
{
}
......@@ -282,4 +286,3 @@ QDate Decoration::yearDate(const QDate &date)
{
return QDate(date.year(), 1, 1);
}
......@@ -28,12 +28,8 @@
#include <QDate>
#include <QPixmap>
namespace EventViews
{
namespace CalendarDecoration
{
namespace EventViews {
namespace CalendarDecoration {
/**
@class Element
......@@ -118,10 +114,9 @@ class EVENTVIEWS_EXPORT StoredElement : public Element
public:
explicit StoredElement(const QString &id);
StoredElement(const QString &id, const QString &shortText);
StoredElement(const QString &id, const QString &shortText,
const QString &longText);
StoredElement(const QString &id, const QString &shortText,
const QString &longText, const QString &extensiveText);
StoredElement(const QString &id, const QString &shortText, const QString &longText);
StoredElement(const QString &id, const QString &shortText, const QString &longText,
const QString &extensiveText);
StoredElement(const QString &id, const QPixmap &pixmap);
virtual void setShortText(const QString &t);
......@@ -162,6 +157,7 @@ public:
{
return 2;
}
static QString serviceType()
{
return QStringLiteral("Calendar/Decoration");
......@@ -265,9 +261,7 @@ class EVENTVIEWS_EXPORT DecorationFactory : public CalendarSupport::PluginFactor
public:
Decoration *createPluginFactory() override = 0;
};
}
}
#endif
......@@ -30,11 +30,13 @@
using namespace EventViews;
DecorationLabel::DecorationLabel(CalendarDecoration::Element *e,
QWidget *parent)
: QLabel(parent), mAutomaticSqueeze(true), mDecorationElement(e),
mShortText(e->shortText()), mLongText(e->longText()),
mExtensiveText(e->extensiveText())
DecorationLabel::DecorationLabel(CalendarDecoration::Element *e, QWidget *parent)
: QLabel(parent)
, mAutomaticSqueeze(true)
, mDecorationElement(e)
, mShortText(e->shortText())
, mLongText(e->longText())
, mExtensiveText(e->extensiveText())
{
mPixmap = e->newPixmap(size());
mUrl = e->url();
......@@ -53,15 +55,15 @@ DecorationLabel::DecorationLabel(CalendarDecoration::Element *e,
squeezeContentsToLabel();
}
DecorationLabel::DecorationLabel(const QString &shortText,
const QString &longText,
const QString &extensiveText,
const QPixmap &pixmap,
const QUrl &url,
QWidget *parent)
: QLabel(parent), mAutomaticSqueeze(true), mShortText(shortText),
mLongText(longText), mExtensiveText(extensiveText),
mPixmap(pixmap)
DecorationLabel::DecorationLabel(const QString &shortText, const QString &longText,
const QString &extensiveText, const QPixmap &pixmap,
const QUrl &url, QWidget *parent)
: QLabel(parent)
, mAutomaticSqueeze(true)
, mShortText(shortText)
, mLongText(longText)
, mExtensiveText(extensiveText)
, mPixmap(pixmap)
{
setUrl(url);
......@@ -78,7 +80,7 @@ void DecorationLabel::mouseReleaseEvent(QMouseEvent *event)
switch (event->button()) {
case Qt::LeftButton:
if (! mUrl.isEmpty()) {
if (!mUrl.isEmpty()) {
QDesktopServices::openUrl(mUrl);
setForegroundRole(QPalette::LinkVisited);
}
......@@ -158,7 +160,7 @@ void DecorationLabel::squeezeContentsToLabel()
int longTextWidth = fm.width(mLongText);
int extensiveTextWidth = fm.width(mExtensiveText);
if (! mPixmap.isNull()) {
if (!mPixmap.isNull()) {
usePixmap(true);
} else if ((!mExtensiveText.isEmpty()) && (extensiveTextWidth <= labelWidth)) {
useExtensiveText(true);
......@@ -211,4 +213,3 @@ void DecorationLabel::useShortText(bool allowAutomaticSqueeze)
QLabel::setText(mShortText);
setToolTip(mExtensiveText.isEmpty() ? mLongText : mExtensiveText);
}
......@@ -28,22 +28,18 @@
#include <QLabel>
namespace EventViews
{
namespace EventViews {
class DecorationLabel : public QLabel
{
Q_OBJECT
public:
explicit DecorationLabel(EventViews::CalendarDecoration::Element *e,
QWidget *parent = nullptr);
explicit DecorationLabel(EventViews::CalendarDecoration::Element *e, QWidget *parent = nullptr);
explicit DecorationLabel(const QString &shortText,
const QString &longText = QString(),
const QString &extensiveText = QString(),
const QPixmap &pixmap = QPixmap(),
const QUrl &url = QUrl(),
QWidget *parent = nullptr);
const QUrl &url = QUrl(), QWidget *parent = nullptr);
~DecorationLabel();
public Q_SLOTS:
......@@ -69,7 +65,6 @@ protected:
QPixmap mPixmap;
QUrl mUrl;
};
}
#endif
......@@ -37,9 +37,9 @@
using namespace EventViews;
TimeLabels::TimeLabels(const QTimeZone &zone, int rows, TimeLabelsZone *parent, Qt::WindowFlags f) :
QFrame(parent, f),
mTimezone(zone)
TimeLabels::TimeLabels(const QTimeZone &zone, int rows, TimeLabelsZone *parent, Qt::WindowFlags f)
: QFrame(parent, f)
, mTimezone(zone)
{
mTimeLabelsZone = parent;
mRows = rows;
......@@ -184,12 +184,13 @@ void TimeLabels::paintEvent(QPaintEvent *)
// We won't paint parts that aren't visible
const int cy = -y();// y() returns a negative value.
const auto firstDay = QDateTime(mAgenda->dateList().first(), QTime(0,0,0), Qt::LocalTime).toUTC();
const int beginning =
!mTimezone.isValid() ?
0 :
(mTimezone.offsetFromUtc(firstDay) -
mTimeLabelsZone->preferences()->timeZone().offsetFromUtc(firstDay)) / (60 * 60);
const auto firstDay
= QDateTime(mAgenda->dateList().first(), QTime(0, 0, 0), Qt::LocalTime).toUTC();
const int beginning
= !mTimezone.isValid()
? 0
: (mTimezone.offsetFromUtc(firstDay)
-mTimeLabelsZone->preferences()->timeZone().offsetFromUtc(firstDay)) / (60 * 60);
// bug: the parameters cx and cw are the areas that need to be
// redrawn, not the area of the widget. unfortunately, this
......@@ -301,21 +302,22 @@ void TimeLabels::contextMenuEvent(QContextMenuEvent *event)
Q_UNUSED(event);
QMenu popup(this);
QAction *editTimeZones =
popup.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n("&Add Timezones..."));
QAction *removeTimeZone =
popup.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
i18n("&Remove Timezone %1", i18n(mTimezone.id().constData())));
if (!mTimezone.isValid() ||
!mTimeLabelsZone->preferences()->timeScaleTimezones().count() ||
mTimezone == mTimeLabelsZone->preferences()->timeZone()) {
QAction *editTimeZones
= popup.addAction(QIcon::fromTheme(QStringLiteral("document-properties")),
i18n("&Add Timezones..."));
QAction *removeTimeZone
= popup.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
i18n("&Remove Timezone %1", i18n(mTimezone.id().constData())));
if (!mTimezone.isValid()
|| !mTimeLabelsZone->preferences()->timeScaleTimezones().count()
|| mTimezone == mTimeLabelsZone->preferences()->timeZone()) {
removeTimeZone->setEnabled(false);
}
QAction *activatedAction = popup.exec(QCursor::pos());
if (activatedAction == editTimeZones) {
QPointer<TimeScaleConfigDialog> dialog =
new TimeScaleConfigDialog(mTimeLabelsZone->preferences(), this);
QPointer<TimeScaleConfigDialog> dialog
= new TimeScaleConfigDialog(mTimeLabelsZone->preferences(), this);
if (dialog->exec() == QDialog::Accepted) {
mTimeLabelsZone->reset();
}
......@@ -354,7 +356,9 @@ QString TimeLabels::headerToolTip() const
}
auto abbreviations = QStringLiteral("&nbsp;");
foreach (const auto &transition, mTimezone.transitions(QDateTime::currentDateTime(), QDateTime::currentDateTime().addYears(1))) {
foreach (const auto &transition,
mTimezone.transitions(QDateTime::currentDateTime(),
QDateTime::currentDateTime().addYears(1))) {
abbreviations += transition.abbreviation;
abbreviations += QLatin1String(",&nbsp;");
}
......@@ -372,4 +376,3 @@ QString TimeLabels::headerToolTip() const
return toolTip;
}
......@@ -28,9 +28,7 @@
#include <QFrame>
namespace EventViews
{
namespace EventViews {
class Agenda;
class TimeLabelsZone;
......@@ -43,7 +41,8 @@ class TimeLabels : public QFrame
public:
typedef QList<TimeLabels *> List;
TimeLabels(const QTimeZone &zone, int rows, TimeLabelsZone *parent = nullptr, Qt::WindowFlags f = nullptr);
TimeLabels(const QTimeZone &zone, int rows, TimeLabelsZone *parent = nullptr,
Qt::WindowFlags f = nullptr);
/** updates widget's internal state */
void updateConfig();
......@@ -92,7 +91,6 @@ private:
QFrame *mMousePos = nullptr; // shows a marker for the current mouse position in y direction
};
}
#endif
......@@ -25,7 +25,6 @@
#include "prefs.h"
#include "timelabels.h"
#include <QHBoxLayout>
#include <QScrollArea>
#include <QScrollBar>
......@@ -33,8 +32,10 @@
using namespace EventViews;
TimeLabelsZone::TimeLabelsZone(QWidget *parent, const PrefsPtr &preferences, Agenda *agenda)
: QWidget(parent), mAgenda(agenda), mPrefs(preferences),
mParent(qobject_cast<AgendaView * >(parent))
: QWidget(parent)
, mAgenda(agenda)
, mPrefs(preferences)
, mParent(qobject_cast<AgendaView * >(parent))
{
mTimeLabelsLayout = new QHBoxLayout(this);
mTimeLabelsLayout->setMargin(0);
......@@ -106,7 +107,6 @@ void TimeLabelsZone::setupTimeLabel(QScrollArea *area)
mAgenda->verticalScrollBar(), &QAbstractSlider::setValue);
area->verticalScrollBar()->setValue(mAgenda->verticalScrollBar()->value());
}
TimeLabels *timeLabels = static_cast<TimeLabels *>(area->widget());
......@@ -177,4 +177,3 @@ void TimeLabelsZone::setPreferences(const PrefsPtr &prefs)
mPrefs = prefs;
}
}
......@@ -22,16 +22,13 @@
#ifndef EVENTVIEWS_TIMELABELSZONE_H
#define EVENTVIEWS_TIMELABELSZONE_H
#include <QWidget>
class QHBoxLayout;
class QScrollArea;
class QTimeZone;
namespace EventViews
{
namespace EventViews {
class Agenda;
class AgendaView;
......@@ -78,7 +75,6 @@ private:
QHBoxLayout *mTimeLabelsLayout = nullptr;
QList<QScrollArea *> mTimeLabelsList;
};
}
#endif
......@@ -22,7 +22,6 @@
#include "timescaleconfigdialog.h"
#include "prefs.h"
#include <KLocalizedString>
#include <QIcon>
#include <QDialogButtonBox>
......@@ -36,7 +35,8 @@ class Q_DECL_HIDDEN TimeScaleConfigDialog::Private
{
public:
Private(TimeScaleConfigDialog *parent, const PrefsPtr &preferences)
: q(parent), mPreferences(preferences)