Commit 027424e0 authored by Laurent Montel's avatar Laurent Montel 😁

Modernize code

parent 0d7861ba
Pipeline #39458 passed with stage
in 18 minutes and 7 seconds
......@@ -94,7 +94,7 @@ private Q_SLOTS:
private:
void update();
void updateButtons();
typedef QList<ReminderTreeItem *> ReminderList;
using ReminderList = QList<ReminderTreeItem *>;
static Q_REQUIRED_RESULT QDateTime triggerDateForIncidence(const KCalendarCore::Incidence::Ptr &inc, const QDateTime &reminderAt, QString &displayStr);
......
......@@ -361,7 +361,7 @@ QDate CalendarView::activeIncidenceDate()
}
}
return QDate();
return {};
}
QDate CalendarView::startDate()
......
......@@ -351,7 +351,7 @@ QDate DateNavigatorContainer::monthOfNavigator(int navigatorIndex) const
if (navigatorIndex <= mExtraViews.count() && navigatorIndex >= 0) {
return mExtraViews[navigatorIndex - 1]->month();
} else {
return QDate();
return {};
}
}
......
......@@ -31,7 +31,7 @@ public:
return QStringLiteral("KOrganizer/Part");
}
typedef QList<Part *> List;
using List = QList<Part *>;
explicit Part(MainWindow *parent)
: KParts::Part(parent ? (parent->topLevelWidget()) : nullptr)
......
......@@ -18,7 +18,7 @@ class SummaryEventInfo
{
public:
typedef QList<SummaryEventInfo *> List;
using List = QList<SummaryEventInfo *>;
SummaryEventInfo();
......
......@@ -21,8 +21,8 @@
class CalendarView;
// Workaround for moc workaround for visual c++ 6.0 sucking
typedef KOrg::MainWindow KOrgMainWindow;
typedef KParts::MainWindow KPartsMainWindow;
using KOrgMainWindow = KOrg::MainWindow;
using KPartsMainWindow = KParts::MainWindow;
/**
This is the main class for KOrganizer. It extends the KDE KMainWindow.
......
......@@ -152,7 +152,7 @@ QModelIndex getIndex(const char *string, const QAbstractItemModel &model)
= model.match(model.index(0, 0), Qt::DisplayRole, QString::fromLatin1(
string), 1, Qt::MatchRecursive);
if (list.isEmpty()) {
return QModelIndex();
return {};
}
return list.first();
}
......
......@@ -608,7 +608,7 @@ ReparentingModel::Node *ReparentingModel::extractNode(const QModelIndex &index)
QModelIndex ReparentingModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || column != 0) {
return QModelIndex();
return {};
}
// qCDebug(KORGANIZER_LOG) << parent << row;
const Node *parentNode;
......@@ -630,7 +630,7 @@ QModelIndex ReparentingModel::index(int row, int column, const QModelIndex &pare
QModelIndex ReparentingModel::mapToSource(const QModelIndex &idx) const
{
if (!idx.isValid() || !sourceModel()) {
return QModelIndex();
return {};
}
Node *node = extractNode(idx);
if (!node->isSourceNode()) {
......@@ -655,7 +655,7 @@ QModelIndex ReparentingModel::mapFromSource(const QModelIndex &sourceIndex) cons
{
// qCDebug(KORGANIZER_LOG) << sourceIndex << sourceIndex.data().toString();
if (!sourceIndex.isValid()) {
return QModelIndex();
return {};
}
Node *node = getSourceNode(sourceIndex);
if (!node) {
......@@ -807,7 +807,7 @@ QModelIndex ReparentingModel::index(Node *node) const
{
const int r = row(node);
if (r < 0) {
return QModelIndex();
return {};
}
return createIndex(r, 0, node);
}
......@@ -816,7 +816,7 @@ QModelIndex ReparentingModel::parent(const QModelIndex &child) const
{
// qCDebug(KORGANIZER_LOG) << child << child.data().toString();
if (!child.isValid()) {
return QModelIndex();
return {};
}
const Node *node = extractNode(child);
return index(node->parent);
......@@ -825,7 +825,7 @@ QModelIndex ReparentingModel::parent(const QModelIndex &child) const
QModelIndex ReparentingModel::buddy(const QModelIndex &index) const
{
if (!index.isValid() || !sourceModel()) {
return QModelIndex();
return {};
}
Node *node = extractNode(index);
if (node->isSourceNode()) {
......
......@@ -20,7 +20,7 @@ class ReparentingModel : public QAbstractProxyModel
Q_OBJECT
public:
struct Node {
typedef QSharedPointer<Node> Ptr;
using Ptr = QSharedPointer<Node>;
virtual ~Node();
virtual bool operator==(const Node &) const;
......@@ -51,7 +51,7 @@ public:
};
struct NodeManager {
typedef QSharedPointer<NodeManager> Ptr;
using Ptr = QSharedPointer<NodeManager>;
NodeManager(ReparentingModel &m) : model(m)
{
......
......@@ -121,8 +121,8 @@ void KDateNavigator::setBaseDate(const QDate &date)
QSizePolicy KDateNavigator::sizePolicy() const
{
return QSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding);
return {QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding};
}
void KDateNavigator::updateToday()
......
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