Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1f3caae4 authored by Allen Winter's avatar Allen Winter

various - check for empty lists, per clazy

parent 287a3058
......@@ -433,7 +433,10 @@ void CalendarView::readSettings()
if (dateCount == 7) {
mDateNavigator->selectWeek();
} else {
mDateNavigator->selectDates(mDateNavigator->selectedDates().first(), dateCount);
const KCalCore::DateList dates = mDateNavigator->selectedDates();
if (!dates.isEmpty()) {
mDateNavigator->selectDates(dates.first(), dateCount);
}
}
}
......@@ -851,11 +854,13 @@ void CalendarView::edit_paste()
} else if (curView == monthView && monthView->selectionStart().isValid()) {
finalDateTime = QDateTime(monthView->selectionStart().date());
pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
} else if (!mDateNavigator->selectedDates().isEmpty() &&
curView->supportsDateNavigation()) {
} else if (!mDateNavigator->selectedDates().isEmpty() && curView->supportsDateNavigation()) {
// default to the selected date from the navigator
finalDateTime = QDateTime(mDateNavigator->selectedDates().first());
pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
const KCalCore::DateList dates = mDateNavigator->selectedDates();
if (!dates.isEmpty()) {
finalDateTime = QDateTime(dates.first());
pasteFlags = KCalUtils::DndFactory::FlagPasteAtOriginalTime;
}
}
if (!finalDateTime.isValid() && curView->supportsDateNavigation()) {
......@@ -2792,4 +2797,3 @@ void CalendarView::handleIncidenceCreated(const Akonadi::Item &item)
mMessageWidget->show();
}
}
......@@ -258,11 +258,14 @@ void DateNavigatorContainer::resizeAllContents()
mHorizontalCount = horizontalCount;
mVerticalCount = verticalCount;
setBaseDates(mNavigatorView->selectedDates().first());
selectDates(mNavigatorView->selectedDates());
for (KDateNavigator *n : qAsConst(mExtraViews)) {
if (n) {
n->show();
const KCalCore::DateList dates = mNavigatorView->selectedDates();
if (!dates.isEmpty()) {
setBaseDates(dates.first());
selectDates(dates);
for (KDateNavigator *n : qAsConst(mExtraViews)) {
if (n) {
n->show();
}
}
}
}
......@@ -423,4 +426,3 @@ KDateNavigator *DateNavigatorContainer::firstNavigatorForDate(const QDate &date)
return navigator;
}
......@@ -89,12 +89,16 @@ void ManageShowCollectionProperties::slotCollectionPropertiesFinished(KJob *job)
return;
}
const Akonadi::Collection collection = fetch->collections().first();
const Akonadi::Collection::List collections = fetch->collections();
if (!collections.isEmpty()) {
const Akonadi::Collection collection = collections.first();
QPointer<Akonadi::CollectionPropertiesDialog> dlg = new Akonadi::CollectionPropertiesDialog(collection, mPages, mCollectionView);
dlg->setWindowTitle(i18nc("@title:window", "Properties of Calendar Folder %1", collection.name()));
QPointer<Akonadi::CollectionPropertiesDialog> dlg =
new Akonadi::CollectionPropertiesDialog(collection, mPages, mCollectionView);
dlg->setWindowTitle(i18nc("@title:window", "Properties of Calendar Folder %1", collection.name()));
dlg->show();
mHashDialogBox.insert(collection.id(), dlg);
dlg->show();
mHashDialogBox.insert(collection.id(), dlg);
delete dlg;
}
}
......@@ -675,7 +675,9 @@ void ReparentingModelTest::testInvalidLayoutChanged()
QTest::qWait(0);
//Take reference to proxy node
QPersistentModelIndex persistentIndex = getIndexList("row1", reparentingModel).first();
const QModelIndexList row1List = getIndexList("row1", reparentingModel);
QVERIFY(!row1List.isEmpty());
QPersistentModelIndex persistentIndex = row1List.first();
QVERIFY(persistentIndex.isValid());
sourceModel.appendRow(new QStandardItem(QStringLiteral("row1")));
......@@ -781,4 +783,3 @@ void ReparentingModelTest::testDataChanged()
QTEST_MAIN(ReparentingModelTest)
#include "reparentingmodeltest.moc"
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