install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart)
+install(FILES dolphinpart.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphinpart)
install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
const int argsCount = args->count();
- QList<KUrl> urls;
+ QList<QUrl> urls;
for (int i = 0; i < argsCount; ++i) {
const KUrl url = args->url(i);
if (url.isValid()) {
{
}
-void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs)
+void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs)
{
m_tabWidget->openDirectories(dirs);
}
-void DolphinMainWindow::openFiles(const QList<KUrl>& files)
+void DolphinMainWindow::openFiles(const QList<QUrl>& files)
{
m_tabWidget->openFiles(files);
}
* Opens each directory in \p dirs in a separate tab. If the "split view"
* option is enabled, 2 directories are collected within one tab.
*/
- void openDirectories(const QList<KUrl>& dirs);
+ void openDirectories(const QList<QUrl> &dirs);
/**
* Opens the directory which contains the files \p files
* and selects all files (implements the --select option
* of Dolphin).
*/
- void openFiles(const QList<KUrl>& files);
+ void openFiles(const QList<QUrl>& files);
/**
* Returns the 'Create New...' sub menu which also can be shared
#include <kdeversion.h>
#include <KSharedConfig>
#include <KConfigGroup>
+#include <KComponentData>
#include "dolphinpart_ext.h"
#include "dolphinnewfilemenu.h"
,m_removeAction(0)
{
Q_UNUSED(args)
-#pragma message("TODO: port to KF5")
- //setComponentData(DolphinPartFactory::componentData(), false);
+ setComponentData(*createAboutData(), false);
m_extension = new DolphinPartBrowserExtension(this);
// make sure that other apps using this part find Dolphin's view-file-columns icons
}
}
-void DolphinPart::createNewWindow(const KUrl& url)
+void DolphinPart::createNewWindow(const QUrl& url)
{
// TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
// should be moved into DolphinPart::slotItemActivated()
void DolphinPart::slotOpenContextMenu(const QPoint& pos,
const KFileItem& _item,
- const KUrl&,
+ const QUrl &,
const QList<QAction*>& customActions)
{
KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
actionGroups);
}
-void DolphinPart::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl)
{
//kDebug() << oldUrl << newUrl << "currentUrl=" << url();
- if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) {
+ if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) {
KParts::ReadOnlyPart::setUrl(newUrl);
- const QString prettyUrl = newUrl.pathOrUrl();
+ const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile);
emit m_extension->setLocationBarUrl(prettyUrl);
}
}
m_newFileMenu->createDirectory();
}
-void DolphinPart::setFilesToSelect(const KUrl::List& files)
+void DolphinPart::setFilesToSelect(const QList<QUrl>& files)
{
if (files.isEmpty()) {
return;
Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter )
// Used by konqueror to implement the --select command-line option
- Q_PROPERTY( KUrl::List filesToSelect READ filesToSelect WRITE setFilesToSelect )
+ Q_PROPERTY( QList<QUrl> filesToSelect READ filesToSelect WRITE setFilesToSelect )
public:
explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args);
/**
* Creates a new window showing the content of \a url.
*/
- void createNewWindow(const KUrl& url);
+ void createNewWindow(const QUrl &url);
/**
* Opens the context menu on the current mouse position.
* @pos Position in screen coordinates.
*/
void slotOpenContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
/**
* Testcase 1: fish://localhost
* Testcase 2: showing a directory that is being renamed by another window (#180156)
*/
- void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Updates the state of the 'Edit' menu actions and emits
/**
* Called by konqueror --select
*/
- void setFilesToSelect(const KUrl::List& files);
- KUrl::List filesToSelect() const { return KUrl::List(); } // silence moc
+ void setFilesToSelect(const QList<QUrl> &files);
+ QList<QUrl> filesToSelect() const { return QList<QUrl>(); } // silence moc
virtual bool eventFilter(QObject*, QEvent*);
#include <QSplitter>
#include <QVBoxLayout>
-DolphinTabPage::DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl, QWidget* parent) :
+DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, QWidget* parent) :
QWidget(parent),
m_primaryViewActive(true),
m_splitViewEnabled(false)
return selectedItemsCount;
}
-void DolphinTabPage::markUrlsAsSelected(const QList<KUrl>& urls)
+void DolphinTabPage::markUrlsAsSelected(const QList<QUrl>& urls)
{
m_primaryViewContainer->view()->markUrlsAsSelected(urls);
if (m_splitViewEnabled) {
}
}
-void DolphinTabPage::markUrlAsCurrent(const KUrl& url)
+void DolphinTabPage::markUrlAsCurrent(const QUrl& url)
{
m_primaryViewContainer->view()->markUrlAsCurrent(url);
if (m_splitViewEnabled) {
Q_OBJECT
public:
- explicit DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl(), QWidget* parent = 0);
+ explicit DolphinTabPage(const QUrl& primaryUrl, const QUrl& secondaryUrl = KUrl(), QWidget* parent = 0);
/**
* @return True if primary view is the active view in this tab.
* gets selected if no loading of a directory has been triggered
* by DolphinView::setUrl() or DolphinView::reload().
*/
- void markUrlsAsSelected(const QList<KUrl>& urls);
+ void markUrlsAsSelected(const QList<QUrl> &urls);
/**
* Marks the item indicated by \p url to be scrolled to and as the
* current item after directory DolphinView::url() has been loaded.
*/
- void markUrlAsCurrent(const KUrl& url);
+ void markUrlAsCurrent(const QUrl& url);
/**
* Sets the places selector visible, if \a visible is true.
setCurrentIndex(count() - 1);
}
-void DolphinTabWidget::openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl)
+void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryUrl)
{
QWidget* focusWidget = QApplication::focusWidget();
}
}
-void DolphinTabWidget::openDirectories(const QList<KUrl>& dirs)
+void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs)
{
const bool hasSplitView = GeneralSettings::splitView();
// Open each directory inside a new tab. If the "split view" option has been enabled,
// always show two directories within one tab.
- QList<KUrl>::const_iterator it = dirs.constBegin();
+ QList<QUrl>::const_iterator it = dirs.constBegin();
while (it != dirs.constEnd()) {
- const KUrl& primaryUrl = *(it++);
+ const QUrl& primaryUrl = *(it++);
if (hasSplitView && (it != dirs.constEnd())) {
- const KUrl& secondaryUrl = *(it++);
+ const QUrl& secondaryUrl = *(it++);
openNewTab(primaryUrl, secondaryUrl);
} else {
openNewTab(primaryUrl);
}
}
-void DolphinTabWidget::openFiles(const QList<KUrl>& files)
+void DolphinTabWidget::openFiles(const QList<QUrl>& files)
{
if (files.isEmpty()) {
return;
// Get all distinct directories from 'files' and open a tab
// for each directory. If the "split view" option is enabled, two
// directories are shown inside one tab (see openDirectories()).
- QList<KUrl> dirs;
+ QList<QUrl> dirs;
foreach (const KUrl& url, files) {
const KUrl dir(url.directory());
if (!dirs.contains(dir)) {
* Opens a new tab in the background showing the URL \a primaryUrl and the
* optional URL \a secondaryUrl.
*/
- void openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl());
+ void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = KUrl());
/**
* Opens each directory in \p dirs in a separate tab. If the "split view"
* option is enabled, 2 directories are collected within one tab.
*/
- void openDirectories(const QList<KUrl>& dirs);
+ void openDirectories(const QList<QUrl>& dirs);
/**
* Opens the directory which contains the files \p files
* and selects all files (implements the --select option
* of Dolphin).
*/
- void openFiles(const QList<KUrl>& files);
+ void openFiles(const QList<QUrl> &files);
/**
* Closes the currently active tab.
bool m_placesSelectorVisible;
};
-#endif
\ No newline at end of file
+#endif
qDeleteAll(m_pendingItemsToInsert);
}
-void KFileItemModel::loadDirectory(const KUrl& url)
+void KFileItemModel::loadDirectory(const QUrl &url)
{
m_dirLister->openUrl(url);
}
-void KFileItemModel::refreshDirectory(const KUrl& url)
+void KFileItemModel::refreshDirectory(const QUrl &url)
{
// Refresh all expanded directories first (Bug 295300)
- QHashIterator<KUrl, KUrl> expandedDirs(m_expandedDirs);
+ QHashIterator<QUrl, QUrl> expandedDirs(m_expandedDirs);
while (expandedDirs.hasNext()) {
expandedDirs.next();
m_dirLister->openUrl(expandedDirs.value(), KDirLister::Reload);
m_dirLister->openUrl(url, KDirLister::Reload);
}
-KUrl KFileItemModel::directory() const
+QUrl KFileItemModel::directory() const
{
return m_dirLister->url();
}
return KFileItem();
}
-KFileItem KFileItemModel::fileItem(const KUrl& url) const
+KFileItem KFileItemModel::fileItem(const QUrl &url) const
{
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
int KFileItemModel::index(const KFileItem& item) const
{
- return index(KUrl(item.url()));
+ return index(item.url());
}
-int KFileItemModel::index(const KUrl& url) const
+int KFileItemModel::index(const QUrl& url) const
{
KUrl urlToFind = url;
urlToFind.adjustPath(KUrl::RemoveTrailingSlash);
return 0;
}
-QSet<KUrl> KFileItemModel::expandedDirectories() const
+QSet<QUrl> KFileItemModel::expandedDirectories() const
{
return m_expandedDirs.values().toSet();
}
-void KFileItemModel::restoreExpandedDirectories(const QSet<KUrl>& urls)
+void KFileItemModel::restoreExpandedDirectories(const QSet<QUrl> &urls)
{
m_urlsToExpand = urls;
}
-void KFileItemModel::expandParentDirectories(const KUrl& url)
+void KFileItemModel::expandParentDirectories(const QUrl &url)
{
const int pos = m_dirLister->url().path().length();
// KDirLister::open() must called at least once to trigger an initial
// loading. The pending URLs that must be restored are handled
// in slotCompleted().
- QSetIterator<KUrl> it2(m_urlsToExpand);
+ QSetIterator<QUrl> it2(m_urlsToExpand);
while (it2.hasNext()) {
const int idx = index(it2.next());
if (idx >= 0 && !isExpanded(idx)) {
emit directoryLoadingCanceled();
}
-void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items)
+void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemList& items)
{
Q_ASSERT(!items.isEmpty());
* indicate the current state of the loading process. The items
* of the directory are added after the loading has been completed.
*/
- void loadDirectory(const KUrl& url);
+ void loadDirectory(const QUrl& url);
/**
* Throws away all currently loaded items and refreshes the directory
* by reloading all items again.
*/
- void refreshDirectory(const KUrl& url);
+ void refreshDirectory(const QUrl& url);
/**
* @return Parent directory of the items that are shown. In case
* the root-parent of all items.
* @see rootItem()
*/
- KUrl directory() const;
+ QUrl directory() const;
/**
* Cancels the loading of a directory which has been started by either
* URL is found KFileItem::isNull() will be true for the returned
* file-item. The runtime complexity of this call is O(1).
*/
- KFileItem fileItem(const KUrl& url) const;
+ KFileItem fileItem(const QUrl& url) const;
/**
* @return The index for the file-item \a item. -1 is returned if no file-item
* @return The index for the URL \a url. -1 is returned if no file-item
* is found. The amortized runtime complexity of this call is O(1).
*/
- int index(const KUrl& url) const;
+ int index(const QUrl &url) const;
/**
* @return Root item of all items representing the item
virtual bool isExpandable(int index) const;
virtual int expandedParentsCount(int index) const;
- QSet<KUrl> expandedDirectories() const;
+ QSet<QUrl> expandedDirectories() const;
/**
* Marks the URLs in \a urls as sub-directories which were expanded previously.
* After calling loadDirectory() or refreshDirectory() the marked sub-directories
* will be expanded step-by-step.
*/
- void restoreExpandedDirectories(const QSet<KUrl>& urls);
+ void restoreExpandedDirectories(const QSet<QUrl>& urls);
/**
* Expands all parent-directories of the item \a url.
*/
- void expandParentDirectories(const KUrl& url);
+ void expandParentDirectories(const QUrl& url);
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
* Is emitted if a redirection from the current URL \a oldUrl
* to the new URL \a newUrl has been done.
*/
- void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void directoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Is emitted when the URL passed by KFileItemModel::setUrl() represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const KUrl& url);
+ void urlIsFileError(const QUrl& url);
protected:
virtual void onGroupedSortingChanged(bool current);
void slotCompleted();
void slotCanceled();
- void slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items);
+ void slotItemsAdded(const QUrl& directoryUrl, const KFileItemList& items);
void slotItemsDeleted(const KFileItemList& items);
void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items);
void slotClear();
mutable QList<QPair<int, QVariant> > m_groups;
// Stores the URLs (key: target url, value: url) of the expanded directories.
- QHash<KUrl, KUrl> m_expandedDirs;
+ QHash<QUrl, QUrl> m_expandedDirs;
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
// and done step after step in slotCompleted().
- QSet<KUrl> m_urlsToExpand;
+ QSet<QUrl> m_urlsToExpand;
friend class KFileItemModelLessThan; // Accesses lessThan() method
friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method
// We rename d.txt back to a.txt using the dir lister's refreshItems() signal.
const KFileItem fileItemD = m_model->fileItem(2);
KFileItem fileItemA = fileItemD;
- KUrl urlA = fileItemA.url();
- urlA.setFileName("a.txt");
+ QUrl urlA = fileItemA.url();
+ urlA.adjusted(QUrl::RemoveFilename);
+ urlA.setPath(urlA.path() + "a.txt");
fileItemA.setUrl(urlA);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemA));
m_testDir->createFiles(files);
// Store the URLs of all folders in a set.
- QSet<KUrl> allFolders;
- allFolders << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
+ QSet<QUrl> allFolders;
+ allFolders << QUrl::fromLocalFile(m_testDir->name() + 'a')
+ << QUrl::fromLocalFile(m_testDir->name() + "a/a")
+ << QUrl::fromLocalFile(m_testDir->name() + "a/a-1");
m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QVERIFY(m_model->isExpanded(0));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3); // 3 items: "a/", "a/a/", "a/a-1/"
- QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a'));
+ QCOMPARE(m_model->expandedDirectories(), QSet<QUrl>() << QUrl(m_testDir->name() + 'a'));
QCOMPARE(spyInserted.count(), 1);
KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
QVERIFY(m_model->isExpanded(1));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 4); // 4 items: "a/", "a/a/", "a/a/1", "a/a-1/"
- QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a"));
+ QCOMPARE(m_model->expandedDirectories(), QSet<QUrl>() << QUrl(m_testDir->name() + 'a') << QUrl(m_testDir->name() + "a/a"));
QCOMPARE(spyInserted.count(), 1);
itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
m_model->setExpanded(0, false);
QVERIFY(!m_model->isExpanded(0));
QCOMPARE(m_model->count(), 1);
- QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed
+ QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed
QCOMPARE(spyRemoved.count(), 1);
itemRangeList = spyRemoved.takeFirst().at(0).value<KItemRangeList>();
// Move to a sub folder, then call restoreExpandedFolders() *before* going back.
// This is how DolphinView restores the expanded folders when navigating in history.
- m_model->loadDirectory(KUrl(m_testDir->name() + "a/a/"));
+ m_model->loadDirectory(QUrl(m_testDir->name() + "a/a/"));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 1); // 1 item: "1"
m_model->restoreExpandedDirectories(allFolders);
m_model->setRoles(originalModelRoles);
QVERIFY(!m_model->isExpanded(0));
QCOMPARE(m_model->count(), 1);
- QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a')));
+ QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a')));
QCOMPARE(spyRemoved.count(), 1);
itemRangeList = spyRemoved.takeFirst().at(0).value<KItemRangeList>();
QVERIFY(m_model->expandedDirectories().empty());
// Expand the parents of "a2/b2/c2".
- m_model->expandParentDirectories(KUrl(m_testDir->name() + "a2/b2/c2"));
+ m_model->expandParentDirectories(QUrl(m_testDir->name() + "a2/b2/c2"));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a2/", "a2/b2/", and "a2/b2/c2/".
QVERIFY(!m_model->isExpanded(3));
// Expand the parents of "a 1/b1".
- m_model->expandParentDirectories(KUrl(m_testDir->name() + "a 1/b1"));
+ m_model->expandParentDirectories(QUrl(m_testDir->name() + "a 1/b1"));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a 1/b1/", "a2/", "a2/b2", and "a2/b2/c2/".
m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
- int index = m_model->index(KUrl(m_testDir->url().url() + 'c'));
+ int index = m_model->index(QUrl(m_testDir->url().url() + 'c'));
m_model->setExpanded(index, true);
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
- index = m_model->index(KUrl(m_testDir->url().url() + "c/c-2"));
+ index = m_model->index(QUrl(m_testDir->url().url() + "c/c-2"));
m_model->setExpanded(index, true);
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
roles.insert("expandedParentsCount");
m_model->setRoles(roles);
- const KUrl emptyUrl;
+ const QUrl emptyUrl;
QVERIFY(emptyUrl.path().isEmpty());
- const KUrl url("file:///test/");
+ const QUrl url("file:///test/");
KFileItemList items;
items << KFileItem(emptyUrl, QString(), KFileItem::Unknown) << KFileItem(url, QString(), KFileItem::Unknown);
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "parent2" << "realChild2" << "realGrandChild2");
// Add some more children and grand-children.
- const KUrl parent1 = m_model->fileItem(0).url();
- const KUrl parent2 = m_model->fileItem(3).url();
- const KUrl realChild1 = m_model->fileItem(1).url();
- const KUrl realChild2 = m_model->fileItem(4).url();
+ const QUrl parent1 = m_model->fileItem(0).url();
+ const QUrl parent2 = m_model->fileItem(3).url();
+ const QUrl realChild1 = m_model->fileItem(1).url();
+ const QUrl realChild2 = m_model->fileItem(4).url();
- m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(KUrl("child1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(QUrl("child1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2");
- m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(KUrl("child2"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(QUrl("child2"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(KUrl("grandChild2"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(QUrl("grandChild2"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "grandChild2" << "realGrandChild2" << "child2");
// Change d.txt back to c.txt, but this time using the dir lister's refreshItems() signal.
const KFileItem fileItemD = m_model->fileItem(2);
KFileItem fileItemC = fileItemD;
- KUrl urlC = fileItemC.url();
- urlC.setFileName("c.txt");
+ QUrl urlC = fileItemC.url();
+ urlC.adjusted(QUrl::RemoveFilename);
+ urlC.setPath(urlC.path() + "c.txt");
fileItemC.setUrl(urlC);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemC));
// Note that the first item in the list of added items must be new (i.e., not
// in the model yet). Otherwise, KFileItemModel::slotItemsAdded() will see that
// it receives items that are in the model already and ignore them.
- KUrl url(m_model->directory().url() + "/a2");
+ QUrl url(m_model->directory().url() + "/a2");
KFileItem newItem(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItemList items;
// Rename one of the .jpg files.
KFileItem fileItemE = fileItemC;
- KUrl urlE = fileItemE.url();
- urlE.setFileName("e.jpg");
+ QUrl urlE = fileItemE.url();
+ urlE.adjusted(QUrl::RemoveFilename);
+ urlE.setPath(urlE.path() + "e.jpg");
fileItemE.setUrl(urlE);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemC, fileItemE));
// signal is not emitted yet.
const KFileItem fileItemC1 = m_model->fileItem(2);
KFileItem fileItemC2 = fileItemC1;
- KUrl urlC2 = fileItemC2.url();
- urlC2.setFileName("c2.txt");
+ QUrl urlC2 = fileItemC2.url();
+ urlC2.adjusted(QUrl::RemoveFilename);
+ urlC2.setPath(urlC2.path() + "c2.txt");
fileItemC2.setUrl(urlC2);
- const KUrl urlB = m_model->fileItem(1).url();
+ const QUrl urlB = m_model->fileItem(1).url();
m_model->slotItemsAdded(urlB, KFileItemList() << fileItemC2);
QCOMPARE(itemsInModel(), QStringList() << "a2" << "b" << "c1.txt");
// completed() signal is not emitted yet.
const KFileItem fileItemA2 = m_model->fileItem(0);
KFileItem fileItemA1 = fileItemA2;
- KUrl urlA1 = fileItemA1.url();
- urlA1.setFileName("a1");
+ QUrl urlA1 = fileItemA1.url();
+ urlA1.adjusted(QUrl::RemoveFilename);
+ urlA1.setPath(urlA1.path() + "a1");
fileItemA1.setUrl(urlA1);
m_model->slotItemsAdded(m_model->directory(), KFileItemList() << fileItemA1);
const int MaxModeEnum = DolphinView::CompactView;
};
-DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
+DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
QWidget(parent),
m_active(true),
m_tabsForFiles(false),
{
}
-KUrl DolphinView::url() const
+QUrl DolphinView::url() const
{
return m_url;
}
return selectionManager->selectedItems().count();
}
-void DolphinView::markUrlsAsSelected(const QList<KUrl>& urls)
+void DolphinView::markUrlsAsSelected(const QList<QUrl>& urls)
{
m_selectedUrls = urls;
}
-void DolphinView::markUrlAsCurrent(const KUrl& url)
+void DolphinView::markUrlAsCurrent(const QUrl &url)
{
m_currentItemUrl = url;
m_scrollToCurrentItem = true;
// Mark the dropped urls as selected.
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
+ connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
setActive(true);
}
}
-void DolphinView::slotAboutToCreate(const KUrl::List& urls)
+void DolphinView::slotAboutToCreate(const QList<QUrl>& urls)
{
if (!urls.isEmpty()) {
if (m_markFirstNewlySelectedItemAsCurrent) {
markUrlAsCurrent(urls.first());
m_markFirstNewlySelectedItemAsCurrent = false;
}
- m_selectedUrls << KUrl::List(KDirModel::simplifiedUrlList(urls));
+ m_selectedUrls << KDirModel::simplifiedUrlList(urls);
}
}
stream >> m_restoredContentsPosition;
// Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
- QSet<KUrl> urls;
+ QSet<QUrl> urls;
stream >> urls;
m_model->restoreExpandedDirectories(urls);
}
return KUrl();
}
-void DolphinView::observeCreatedItem(const KUrl& url)
+void DolphinView::observeCreatedItem(const QUrl& url)
{
if (m_active) {
clearSelection();
markUrlAsCurrent(url);
- markUrlsAsSelected(QList<KUrl>() << url);
+ markUrlsAsSelected(QList<QUrl>() << url);
}
}
-void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinView::slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl)
{
- if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) {
+ if (oldUrl.matches(url(), QUrl::StripTrailingSlash)) {
emit redirection(oldUrl, newUrl);
m_url = newUrl; // #186947
}
void DolphinView::updateViewState()
{
- if (m_currentItemUrl != KUrl()) {
+ if (m_currentItemUrl != QUrl()) {
KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
const int currentIndex = m_model->index(m_currentItemUrl);
if (currentIndex != -1) {
selectionManager->setCurrentItem(0);
}
- m_currentItemUrl = KUrl();
+ m_currentItemUrl = QUrl();
}
if (!m_restoredContentsPosition.isNull()) {
KItemSet selectedItems = selectionManager->selectedItems();
- QList<KUrl>::iterator it = m_selectedUrls.begin();
+ QList<QUrl>::iterator it = m_selectedUrls.begin();
while (it != m_selectedUrls.end()) {
const int index = m_model->index(*it);
if (index >= 0) {
KIO::CopyJob *copyJob = qobject_cast<KIO::CopyJob *>(job);
Q_ASSERT(copyJob);
const QUrl newUrl = copyJob->destUrl();
- const int index = m_model->index(KUrl(newUrl));
+ const int index = m_model->index(newUrl);
if (index >= 0) {
QHash<QByteArray, QVariant> data;
const QUrl oldUrl = copyJob->srcUrls().first();
if (op) {
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
+ connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
}
* @param url Specifies the content which should be shown.
* @param parent Parent widget of the view.
*/
- DolphinView(const KUrl& url, QWidget* parent);
+ DolphinView(const QUrl& url, QWidget* parent);
virtual ~DolphinView();
* Returns the current active URL, where all actions are applied.
* The URL navigator is synchronized with this URL.
*/
- KUrl url() const;
+ QUrl url() const;
/**
* If \a active is true, the view will marked as active. The active
* gets selected if no loading of a directory has been triggered
* by DolphinView::setUrl() or DolphinView::reload().
*/
- void markUrlsAsSelected(const QList<KUrl>& urls);
+ void markUrlsAsSelected(const QList<QUrl> &urls);
/**
* Marks the item indicated by \p url to be scrolled to and as the
* current item after directory DolphinView::url() has been loaded.
*/
- void markUrlAsCurrent(const KUrl& url);
+ void markUrlAsCurrent(const QUrl& url);
/**
* All items that match to the pattern \a pattern will get selected
/*
* Is called when new items get pasted or dropped.
*/
- void slotAboutToCreate(const KUrl::List& urls);
+ void slotAboutToCreate(const QList<QUrl> &urls);
/**
* Emits the signal \a selectionChanged() with a small delay. This is
* model indicates that the item is available, the item will
* get selected and it is assured that the item stays visible.
*/
- void observeCreatedItem(const KUrl& url);
+ void observeCreatedItem(const QUrl &url);
/**
* Called when a redirection happens.
* Testcase: fish://localhost
*/
- void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Applies the state that has been restored by restoreViewState()
QTimer* m_selectionChangedTimer;
- KUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
+ QUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not
QPoint m_restoredContentsPosition;
- QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
+ QList<QUrl> m_selectedUrls; // Used for making the view to remember selections after F5
bool m_clearSelectionBeforeSelectingNewItems;
bool m_markFirstNewlySelectedItemAsCurrent;