mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-21 09:20:13 +00:00
make use of initializer lists
This commit is contained in:
parent
82f19ab470
commit
d0f0f1f2e2
|
@ -340,7 +340,7 @@ void DolphinMainWindow::openInNewWindow()
|
|||
}
|
||||
|
||||
if (!newWindowUrl.isEmpty()) {
|
||||
KRun::run("dolphin %u", QList<QUrl>() << newWindowUrl, this);
|
||||
KRun::run("dolphin %u", {newWindowUrl}, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
|
|||
|
||||
case DolphinContextMenu::OpenParentFolderInNewWindow: {
|
||||
|
||||
KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);
|
||||
KRun::run("dolphin %u", {KIO::upUrl(item.url())}, this);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,7 @@ void DolphinMainWindow::setupActions()
|
|||
QAction* newTab = actionCollection()->addAction("new_tab");
|
||||
newTab->setIcon(QIcon::fromTheme("tab-new"));
|
||||
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
|
||||
actionCollection()->setDefaultShortcuts(newTab, QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
|
||||
actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N});
|
||||
connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewActivatedTab));
|
||||
|
||||
QAction* closeTab = actionCollection()->addAction("close_tab");
|
||||
|
@ -1173,7 +1173,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
infoDock->setObjectName("infoDock");
|
||||
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
InformationPanel* infoPanel = new InformationPanel(infoDock);
|
||||
infoPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
infoPanel->setCustomContextMenuActions({lockLayoutAction});
|
||||
connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
|
||||
infoDock->setWidget(infoPanel);
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
foldersDock->setObjectName("foldersDock");
|
||||
foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
FoldersPanel* foldersPanel = new FoldersPanel(foldersDock);
|
||||
foldersPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
foldersPanel->setCustomContextMenuActions({lockLayoutAction});
|
||||
foldersDock->setWidget(foldersPanel);
|
||||
|
||||
QAction* foldersAction = foldersDock->toggleViewAction();
|
||||
|
@ -1217,7 +1217,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
terminalDock->setObjectName("terminalDock");
|
||||
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||
TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
|
||||
terminalPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
terminalPanel->setCustomContextMenuActions({lockLayoutAction});
|
||||
terminalDock->setWidget(terminalPanel);
|
||||
|
||||
connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
|
||||
|
@ -1248,7 +1248,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
PlacesPanel* placesPanel = new PlacesPanel(placesDock);
|
||||
placesPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
|
||||
placesPanel->setCustomContextMenuActions({lockLayoutAction});
|
||||
placesDock->setWidget(placesPanel);
|
||||
|
||||
QAction* placesAction = placesDock->toggleViewAction();
|
||||
|
|
|
@ -556,7 +556,7 @@ void DolphinPart::slotOpenTerminal()
|
|||
|
||||
void DolphinPart::slotFindFile()
|
||||
{
|
||||
KRun::run("kfind", QList<QUrl>() << url(), widget());
|
||||
KRun::run("kfind", {url()}, widget());
|
||||
}
|
||||
|
||||
void DolphinPart::updateNewMenu()
|
||||
|
|
|
@ -66,7 +66,7 @@ KFileItemListView::KFileItemListView(QGraphicsWidget* parent) :
|
|||
m_updateIconSizeTimer->setInterval(LongInterval);
|
||||
connect(m_updateIconSizeTimer, &QTimer::timeout, this, &KFileItemListView::updateIconSize);
|
||||
|
||||
setVisibleRoles(QList<QByteArray>() << "text");
|
||||
setVisibleRoles({"text"});
|
||||
}
|
||||
|
||||
KFileItemListView::~KFileItemListView()
|
||||
|
@ -205,7 +205,7 @@ void KFileItemListView::initializeItemListWidget(KItemListWidget* item)
|
|||
|
||||
const KFileItem fileItem = fileItemModel->fileItem(item->index());
|
||||
data.insert("iconName", fileItem.iconName());
|
||||
item->setData(data, QSet<QByteArray>() << "iconName");
|
||||
item->setData(data, {"iconName"});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ KStandardItemListView::KStandardItemListView(QGraphicsWidget* parent) :
|
|||
{
|
||||
setAcceptDrops(true);
|
||||
setScrollOrientation(Qt::Vertical);
|
||||
setVisibleRoles(QList<QByteArray>() << "text");
|
||||
setVisibleRoles({"text"});
|
||||
}
|
||||
|
||||
KStandardItemListView::~KStandardItemListView()
|
||||
|
|
|
@ -259,7 +259,7 @@ void FoldersPanel::slotRoleEditingFinished(int index, const QByteArray& role, co
|
|||
|
||||
KIO::Job* job = KIO::moveAs(oldUrl, newUrl);
|
||||
KJobWidgets::setWindow(job, this);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, QList<QUrl>() << oldUrl, newUrl, job);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
|
||||
job->ui()->setAutoErrorHandlingEnabled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ void TreeViewContextMenu::rename()
|
|||
|
||||
void TreeViewContextMenu::moveToTrash()
|
||||
{
|
||||
const QList<QUrl> list {m_fileItem.url()};
|
||||
const QList<QUrl> list{m_fileItem.url()};
|
||||
KIO::JobUiDelegate uiDelegate;
|
||||
uiDelegate.setWindow(m_parent);
|
||||
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
|
||||
|
@ -206,7 +206,7 @@ void TreeViewContextMenu::moveToTrash()
|
|||
|
||||
void TreeViewContextMenu::deleteItem()
|
||||
{
|
||||
const QList<QUrl> list {m_fileItem.url()};
|
||||
const QList<QUrl> list{m_fileItem.url()};
|
||||
KIO::JobUiDelegate uiDelegate;
|
||||
uiDelegate.setWindow(m_parent);
|
||||
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
|
||||
|
|
|
@ -873,22 +873,22 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
|
|||
if (path == QLatin1String("/documents")) {
|
||||
props.setViewMode(DolphinView::DetailsView);
|
||||
props.setPreviewsShown(false);
|
||||
props.setVisibleRoles(QList<QByteArray>() << "text" << "path");
|
||||
props.setVisibleRoles({"text", "path"});
|
||||
} else if (path == QLatin1String("/images")) {
|
||||
props.setViewMode(DolphinView::IconsView);
|
||||
props.setPreviewsShown(true);
|
||||
props.setVisibleRoles(QList<QByteArray>() << "text" << "imageSize");
|
||||
props.setVisibleRoles({"text", "imageSize"});
|
||||
} else if (path == QLatin1String("/audio")) {
|
||||
props.setViewMode(DolphinView::DetailsView);
|
||||
props.setPreviewsShown(false);
|
||||
props.setVisibleRoles(QList<QByteArray>() << "text" << "artist" << "album");
|
||||
props.setVisibleRoles({"text", "artist", "album"});
|
||||
} else if (path == QLatin1String("/videos")) {
|
||||
props.setViewMode(DolphinView::IconsView);
|
||||
props.setPreviewsShown(true);
|
||||
props.setVisibleRoles(QList<QByteArray>() << "text");
|
||||
props.setVisibleRoles({"text"});
|
||||
} else if (data.url.scheme() == "timeline") {
|
||||
props.setViewMode(DolphinView::DetailsView);
|
||||
props.setVisibleRoles(QList<QByteArray>() << "text" << "date");
|
||||
props.setVisibleRoles({"text", "date"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ QList<QWidget*> ServiceItemDelegate::createItemWidgets(const QModelIndex&) const
|
|||
QPushButton* configureButton = new QPushButton();
|
||||
connect(configureButton, &QPushButton::clicked, this, &ServiceItemDelegate::slotConfigureButtonClicked);
|
||||
|
||||
return QList<QWidget*>() << checkBox << configureButton;
|
||||
return {checkBox, configureButton};
|
||||
}
|
||||
|
||||
void ServiceItemDelegate::updateItemWidgets(const QList<QWidget*> widgets,
|
||||
|
|
|
@ -93,14 +93,14 @@ void KFileItemListViewTest::testGroupedItemChanges()
|
|||
{
|
||||
m_model->setGroupedSorting(true);
|
||||
|
||||
m_testDir->createFiles(QStringList() << "1" << "3" << "5");
|
||||
m_testDir->createFiles({"1", "3", "5"});
|
||||
|
||||
m_model->loadDirectory(m_testDir->url());
|
||||
QSignalSpy psy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||
QVERIFY(psy.wait(DefaultTimeout));
|
||||
QCOMPARE(m_model->count(), 3);
|
||||
|
||||
m_testDir->createFiles(QStringList() << "2" << "4");
|
||||
m_testDir->createFiles({"2", "4"});
|
||||
m_model->m_dirLister->updateDirectory(m_testDir->url());
|
||||
QSignalSpy psyItemsInserted(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||
QVERIFY(psyItemsInserted.wait(DefaultTimeout));
|
||||
|
|
|
@ -167,7 +167,7 @@ void KFileItemModelBenchmark::insertAndRemoveManyItems()
|
|||
// Avoid overhead caused by natural sorting
|
||||
// and determining the isDir/isLink roles.
|
||||
model.m_naturalSorting = false;
|
||||
model.setRoles(QSet<QByteArray>() << "text");
|
||||
model.setRoles({"text"});
|
||||
|
||||
QSignalSpy spyItemsInserted(&model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||
QSignalSpy spyItemsRemoved(&model, SIGNAL(itemsRemoved(KItemRangeList)));
|
||||
|
|
|
@ -199,7 +199,7 @@ void KFileItemModelTest::testDirLoadingCompleted()
|
|||
QSignalSpy itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
|
||||
|
||||
m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
|
||||
m_testDir->createFiles({"a.txt", "b.txt", "c.txt"});
|
||||
|
||||
m_model->loadDirectory(m_testDir->url());
|
||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
|
||||
|
@ -208,7 +208,7 @@ void KFileItemModelTest::testDirLoadingCompleted()
|
|||
QCOMPARE(itemsRemovedSpy.count(), 0);
|
||||
QCOMPARE(m_model->count(), 3);
|
||||
|
||||
m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
|
||||
m_testDir->createFiles({"d.txt", "e.txt"});
|
||||
m_model->m_dirLister->updateDirectory(m_testDir->url());
|
||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
|
||||
QCOMPARE(loadingCompletedSpy.count(), 2);
|
||||
|
@ -408,7 +408,7 @@ void KFileItemModelTest::testResortAfterChangingName()
|
|||
urlA.setPath(urlA.path() + "a.txt");
|
||||
fileItemA.setUrl(urlA);
|
||||
|
||||
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemA));
|
||||
m_model->slotRefreshItems({qMakePair(fileItemD, fileItemA)});
|
||||
|
||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)), DefaultTimeout));
|
||||
QCOMPARE(itemsInModel(), QStringList() << "a.txt" << "b.txt" << "c.txt");
|
||||
|
@ -1060,7 +1060,7 @@ void KFileItemModelTest::testRefreshExpandedItem()
|
|||
QSignalSpy spyItemsChanged(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)));
|
||||
|
||||
const KFileItem item = m_model->fileItem(0);
|
||||
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(item, item));
|
||||
m_model->slotRefreshItems({qMakePair(item, item)});
|
||||
QVERIFY(!spyItemsChanged.isEmpty());
|
||||
|
||||
QCOMPARE(m_model->count(), 5); // "a/", "a/1", "a/2", "3", "4"
|
||||
|
@ -1077,7 +1077,7 @@ void KFileItemModelTest::testRemoveHiddenItems()
|
|||
m_testDir->createDir(".b");
|
||||
m_testDir->createDir("c");
|
||||
m_testDir->createDir("d");
|
||||
m_testDir->createFiles(QStringList() << ".f" << ".g" << "h" << "i");
|
||||
m_testDir->createFiles({".f", ".g", "h", "i"});
|
||||
|
||||
QSignalSpy spyItemsInserted(m_model, SIGNAL(itemsInserted(KItemRangeList)));
|
||||
QSignalSpy spyItemsRemoved(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
|
||||
|
@ -1361,7 +1361,7 @@ void KFileItemModelTest::testNameRoleGroups()
|
|||
urlC.setPath(urlC.path() + "c.txt");
|
||||
fileItemC.setUrl(urlC);
|
||||
|
||||
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemC));
|
||||
m_model->slotRefreshItems({qMakePair(fileItemD, fileItemC)});
|
||||
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(groupsChanged()), DefaultTimeout));
|
||||
QCOMPARE(itemsInModel(), QStringList() << "a.txt" << "b.txt" << "c.txt" << "e.txt");
|
||||
|
||||
|
@ -1588,7 +1588,7 @@ void KFileItemModelTest::testRefreshFilteredItems()
|
|||
urlE.setPath(urlE.path() + "e.jpg");
|
||||
fileItemE.setUrl(urlE);
|
||||
|
||||
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemC, fileItemE));
|
||||
m_model->slotRefreshItems({qMakePair(fileItemC, fileItemE)});
|
||||
|
||||
// Show all files again, and verify that the model has updated the file name.
|
||||
m_model->setNameFilter(QString());
|
||||
|
|
|
@ -369,7 +369,7 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 2 << 3
|
||||
<< (KItemSet() << 2 << 3 << 5 << 6)
|
||||
<< NoChange
|
||||
<< QList<QVariant>()
|
||||
<< QList<QVariant>{}
|
||||
<< (KItemSet() << 2 << 3 << 5 << 6);
|
||||
|
||||
QTest::newRow("Insert Items")
|
||||
|
@ -377,7 +377,7 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 2 << 3
|
||||
<< (KItemSet() << 2 << 3 << 5 << 6)
|
||||
<< InsertItems
|
||||
<< (QList<QVariant>() << QVariant::fromValue(KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 2) << KItemRange(10, 5)))
|
||||
<< QList<QVariant>{QVariant::fromValue(KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 2) << KItemRange(10, 5))}
|
||||
<< (KItemSet() << 3 << 4 << 8 << 9);
|
||||
|
||||
QTest::newRow("Remove Items")
|
||||
|
@ -385,7 +385,7 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 2 << 3
|
||||
<< (KItemSet() << 2 << 3 << 5 << 6)
|
||||
<< RemoveItems
|
||||
<< (QList<QVariant>() << QVariant::fromValue(KItemRangeList() << KItemRange(1, 1) << KItemRange(3, 1) << KItemRange(10, 5)))
|
||||
<< QList<QVariant>{QVariant::fromValue(KItemRangeList() << KItemRange(1, 1) << KItemRange(3, 1) << KItemRange(10, 5))}
|
||||
<< (KItemSet() << 1 << 2 << 3 << 4);
|
||||
|
||||
QTest::newRow("Empty Anchored Selection")
|
||||
|
@ -393,7 +393,7 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 2 << 2
|
||||
<< KItemSet()
|
||||
<< EndAnchoredSelection
|
||||
<< QList<QVariant>()
|
||||
<< QList<QVariant>{}
|
||||
<< KItemSet();
|
||||
|
||||
QTest::newRow("Toggle selection")
|
||||
|
@ -401,7 +401,7 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 6 << 8
|
||||
<< (KItemSet() << 1 << 3 << 4 << 6 << 7 << 8)
|
||||
<< SetSelected
|
||||
<< (QList<QVariant>() << 0 << 10 << QVariant::fromValue(KItemListSelectionManager::Toggle))
|
||||
<< QList<QVariant>{0, 10, QVariant::fromValue(KItemListSelectionManager::Toggle)}
|
||||
<< (KItemSet() << 0 << 2 << 5 << 9);
|
||||
|
||||
// Swap items 2, 3 and 4, 5
|
||||
|
@ -410,8 +410,8 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< -1 << -1
|
||||
<< (KItemSet() << 0 << 1 << 2 << 3)
|
||||
<< MoveItems
|
||||
<< (QList<QVariant>() << QVariant::fromValue(KItemRange(2, 4))
|
||||
<< QVariant::fromValue(QList<int>() << 4 << 5 << 2 << 3))
|
||||
<< QList<QVariant>{QVariant::fromValue(KItemRange(2, 4)),
|
||||
QVariant::fromValue(QList<int>{4, 5, 2, 3})}
|
||||
<< (KItemSet() << 0 << 1 << 4 << 5);
|
||||
|
||||
QTest::newRow("Move items with active anchored selection")
|
||||
|
@ -419,8 +419,8 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 0 << 3
|
||||
<< (KItemSet() << 0 << 1 << 2 << 3)
|
||||
<< MoveItems
|
||||
<< (QList<QVariant>() << QVariant::fromValue(KItemRange(2, 4))
|
||||
<< QVariant::fromValue(QList<int>() << 4 << 5 << 2 << 3))
|
||||
<< QList<QVariant>{QVariant::fromValue(KItemRange(2, 4)),
|
||||
QVariant::fromValue(QList<int>{4, 5, 2, 3})}
|
||||
<< (KItemSet() << 0 << 1 << 4 << 5);
|
||||
|
||||
// Revert sort order
|
||||
|
@ -429,8 +429,8 @@ void KItemListSelectionManagerTest::testChangeSelection_data()
|
|||
<< 3 << 4
|
||||
<< (KItemSet() << 0 << 1 << 3 << 4)
|
||||
<< MoveItems
|
||||
<< (QList<QVariant>() << QVariant::fromValue(KItemRange(0, 10))
|
||||
<< QVariant::fromValue(QList<int>() << 9 << 8 << 7 << 6 << 5 << 4 << 3 << 2 << 1 << 0))
|
||||
<< QList<QVariant>{QVariant::fromValue(KItemRange(0, 10)),
|
||||
QVariant::fromValue(QList<int>{9, 8, 7, 6, 5, 4, 3, 2, 1, 0})}
|
||||
<< (KItemSet() << 5 << 6 << 8 << 9);
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ void KItemListSelectionManagerTest::testChangeSelection()
|
|||
break;
|
||||
case MoveItems:
|
||||
m_selectionManager->itemsMoved(data.at(0).value<KItemRange>(),
|
||||
data.at(1).value<QList<int> >());
|
||||
data.at(1).value<QList<int>>());
|
||||
break;
|
||||
case EndAnchoredSelection:
|
||||
m_selectionManager->endAnchoredSelection();
|
||||
|
@ -535,7 +535,7 @@ void KItemListSelectionManagerTest::testAnchoredSelectionAfterMovingItems()
|
|||
m_selectionManager->beginAnchoredSelection(4);
|
||||
|
||||
// Reverse the items between 0 and 5.
|
||||
m_selectionManager->itemsMoved(KItemRange(0, 6), QList<int>() << 5 << 4 << 3 << 2 << 1 << 0);
|
||||
m_selectionManager->itemsMoved(KItemRange(0, 6), {5, 4, 3, 2, 1, 0});
|
||||
|
||||
QCOMPARE(m_selectionManager->currentItem(), 1);
|
||||
QCOMPARE(m_selectionManager->m_anchorItem, 1);
|
||||
|
|
|
@ -40,25 +40,25 @@ void KItemRangeTest::testFromSortedContainer_data()
|
|||
QTest::addColumn<QVector<int> >("sortedNumbers");
|
||||
QTest::addColumn<KItemRangeList>("expected");
|
||||
|
||||
QTest::newRow("empty") << QVector<int>() << KItemRangeList();
|
||||
QTest::newRow("[1]") << (QVector<int>() << 1) << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("[9]") << (QVector<int>() << 9) << (KItemRangeList() << KItemRange(9, 1));
|
||||
QTest::newRow("[1-2]") << (QVector<int>() << 1 << 2) << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("[1-3]") << (QVector<int>() << 1 << 2 << 3) << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("[1] [4]") << (QVector<int>() << 1 << 4) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(4, 1));
|
||||
QTest::newRow("[1-3] [5]") << (QVector<int>() << 1 << 2 << 3 << 5) << (KItemRangeList() << KItemRange(1, 3) << KItemRange(5, 1));
|
||||
QTest::newRow("[1] [5-6]") << (QVector<int>() << 1 << 5 << 6) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 2));
|
||||
QTest::newRow("duplicates: 1 1") << (QVector<int>() << 1 << 1) << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("duplicates: 1 1 1") << (QVector<int>() << 1 << 1 << 1) << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("duplicates: 1 1 5") << (QVector<int>() << 1 << 1 << 5) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 5 5") << (QVector<int>() << 1 << 5 << 5) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 1 1 5") << (QVector<int>() << 1 << 1 << 1 << 5) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 5 5 5") << (QVector<int>() << 1 << 5 << 5 << 5) << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 1 2") << (QVector<int>() << 1 << 1 << 2) << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("duplicates: 1 2 2") << (QVector<int>() << 1 << 2 << 2) << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("duplicates: 1 1 2 3") << (QVector<int>() << 1 << 1 << 2 << 3) << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("duplicates: 1 2 2 3") << (QVector<int>() << 1 << 2 << 2 << 3) << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("duplicates: 1 2 3 3") << (QVector<int>() << 1 << 2 << 3 << 3) << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("empty") << QVector<int>{} << KItemRangeList();
|
||||
QTest::newRow("[1]") << QVector<int>{1} << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("[9]") << QVector<int>{9} << (KItemRangeList() << KItemRange(9, 1));
|
||||
QTest::newRow("[1-2]") << QVector<int>{1, 2} << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("[1-3]") << QVector<int>{1, 2, 3} << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("[1] [4]") << QVector<int>{1, 4} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(4, 1));
|
||||
QTest::newRow("[1-3] [5]") << QVector<int>{1, 2, 3, 5} << (KItemRangeList() << KItemRange(1, 3) << KItemRange(5, 1));
|
||||
QTest::newRow("[1] [5-6]") << QVector<int>{1, 5, 6} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 2));
|
||||
QTest::newRow("duplicates: 1 1") << QVector<int>{1, 1} << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("duplicates: 1 1 1") << QVector<int>{1, 1, 1} << (KItemRangeList() << KItemRange(1, 1));
|
||||
QTest::newRow("duplicates: 1 1 5") << QVector<int>{1, 1, 5} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 5 5") << QVector<int>{1, 5, 5} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 1 1 5") << QVector<int>{1, 1, 1, 5} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 5 5 5") << QVector<int>{1, 5, 5, 5} << (KItemRangeList() << KItemRange(1, 1) << KItemRange(5, 1));
|
||||
QTest::newRow("duplicates: 1 1 2") << QVector<int>{1, 1, 2} << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("duplicates: 1 2 2") << QVector<int>{1, 2, 2} << (KItemRangeList() << KItemRange(1, 2));
|
||||
QTest::newRow("duplicates: 1 1 2 3") << QVector<int>{1, 1, 2, 3} << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("duplicates: 1 2 2 3") << QVector<int>{1, 2, 2, 3} << (KItemRangeList() << KItemRange(1, 3));
|
||||
QTest::newRow("duplicates: 1 2 3 3") << QVector<int>{1, 2, 3, 3} << (KItemRangeList() << KItemRange(1, 3));
|
||||
}
|
||||
|
||||
void KItemRangeTest::testFromSortedContainer()
|
||||
|
|
|
@ -125,7 +125,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
|
|||
m_model = new KFileItemModel(this);
|
||||
m_view = new DolphinItemListView();
|
||||
m_view->setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
|
||||
m_view->setVisibleRoles(QList<QByteArray>() << "text");
|
||||
m_view->setVisibleRoles({"text"});
|
||||
applyModeToView();
|
||||
|
||||
KItemListController* controller = new KItemListController(m_model, m_view, this);
|
||||
|
@ -1286,7 +1286,7 @@ void DolphinView::observeCreatedItem(const QUrl& url)
|
|||
if (m_active) {
|
||||
clearSelection();
|
||||
markUrlAsCurrent(url);
|
||||
markUrlsAsSelected(QList<QUrl>() << url);
|
||||
markUrlsAsSelected({url});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
|
|||
|
||||
KIO::Job * job = KIO::moveAs(oldUrl, newUrl);
|
||||
KJobWidgets::setWindow(job, this);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, QList<QUrl>() << oldUrl, newUrl, job);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
|
||||
job->ui()->setAutoErrorHandlingEnabled(true);
|
||||
|
||||
if (!newNameExistsAlready) {
|
||||
|
|
|
@ -141,7 +141,7 @@ void DolphinViewActionHandler::createActions()
|
|||
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
|
||||
propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
|
||||
propertiesAction->setIcon(QIcon::fromTheme("document-properties"));
|
||||
m_actionCollection->setDefaultShortcuts(propertiesAction, QList<QKeySequence>() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter);
|
||||
m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter});
|
||||
connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
|
||||
|
||||
// View menu
|
||||
|
@ -211,7 +211,7 @@ void DolphinViewActionHandler::createActions()
|
|||
|
||||
KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>("show_hidden_files");
|
||||
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
|
||||
m_actionCollection->setDefaultShortcuts(showHiddenFiles, QList<QKeySequence>() << Qt::ALT + Qt::Key_Period << Qt::Key_F8);
|
||||
m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::Key_F8});
|
||||
connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
|
||||
|
||||
QAction* adjustViewProps = m_actionCollection->addAction("view_properties");
|
||||
|
|
|
@ -47,7 +47,7 @@ KonqOperations* DragAndDropHelper::dropUrls(const KFileItem& destItem, const QUr
|
|||
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath,
|
||||
"org.kde.ark.DndExtract", "extractSelectedFilesTo");
|
||||
message.setArguments(QVariantList() << destUrl.toDisplayString(QUrl::PreferLocalFile));
|
||||
message.setArguments({destUrl.toDisplayString(QUrl::PreferLocalFile)});
|
||||
QDBusConnection::sessionBus().call(message);
|
||||
} else if (!destItem.isNull() && (destItem.isDir() || destItem.isDesktopFile())) {
|
||||
// Drop into a directory or a desktop-file
|
||||
|
|
|
@ -159,7 +159,7 @@ void RenameDialog::renameItem(const KFileItem &item, const QString& newName)
|
|||
|
||||
KIO::Job * job = KIO::moveAs(oldUrl, newUrl);
|
||||
KJobWidgets::setWindow(job, widget);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, QList<QUrl>() << oldUrl, newUrl, job);
|
||||
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
|
||||
job->ui()->setAutoErrorHandlingEnabled(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ ViewProperties::ViewProperties(const QUrl& url) :
|
|||
if (useDefaultProps) {
|
||||
if (useDetailsViewWithPath) {
|
||||
setViewMode(DolphinView::DetailsView);
|
||||
setVisibleRoles(QList<QByteArray>() << "path");
|
||||
setVisibleRoles({"path"});
|
||||
} else {
|
||||
// The global view-properties act as default for directories without
|
||||
// any view-property configuration. Constructing a ViewProperties
|
||||
|
@ -286,8 +286,7 @@ QList<QByteArray> ViewProperties::visibleRoles() const
|
|||
// by "CustomizedDetails"), also a details-view with no additional information
|
||||
// is accepted.
|
||||
|
||||
QList<QByteArray> roles;
|
||||
roles.append("text");
|
||||
QList<QByteArray> roles{"text"};
|
||||
|
||||
// Iterate through all stored keys and append all roles that match to
|
||||
// the current view mode.
|
||||
|
|
Loading…
Reference in a new issue