generic: adjust to KFileItem changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-27 19:03:52 +03:00
parent 692edb429a
commit 00c8b9a1a2
18 changed files with 22 additions and 32 deletions

View file

@ -451,7 +451,7 @@ KFileItemListProperties& DolphinContextMenu::selectedItemsProperties() const
KFileItem DolphinContextMenu::baseFileItem() KFileItem DolphinContextMenu::baseFileItem()
{ {
if (!m_baseFileItem) { if (!m_baseFileItem) {
m_baseFileItem = new KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_baseUrl); m_baseFileItem = new KFileItem(m_baseUrl);
} }
return *m_baseFileItem; return *m_baseFileItem;
} }

View file

@ -436,7 +436,7 @@ void DolphinViewContainer::slotDirectoryLoadingCanceled()
void DolphinViewContainer::slotUrlIsFileError(const KUrl& url) void DolphinViewContainer::slotUrlIsFileError(const KUrl& url)
{ {
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); const KFileItem item(url);
// Find out if the file can be opened in the view. The mime type must be known for that. // Find out if the file can be opened in the view. The mime type must be known for that.
const KUrl& folderUrl = DolphinView::openItemAsFolderUrl(item); const KUrl& folderUrl = DolphinView::openItemAsFolderUrl(item);

View file

@ -226,7 +226,7 @@ void InformationPanel::slotFileRenamed(const QString& source, const QString& des
{ {
if (m_shownUrl == KUrl(source)) { if (m_shownUrl == KUrl(source)) {
m_shownUrl = KUrl(dest); m_shownUrl = KUrl(dest);
m_fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl); m_fileItem = KFileItem(m_shownUrl);
if ((m_selection.count() == 1) && (m_selection[0].url() == KUrl(source))) { if ((m_selection.count() == 1) && (m_selection[0].url() == KUrl(source))) {
m_selection[0] = m_fileItem; m_selection[0] = m_fileItem;
@ -245,8 +245,7 @@ void InformationPanel::slotFilesAdded(const QString& directory)
if (m_shownUrl == KUrl(directory)) { if (m_shownUrl == KUrl(directory)) {
// If the 'trash' icon changes because the trash has been emptied or got filled, // If the 'trash' icon changes because the trash has been emptied or got filled,
// the signal filesAdded("trash:/") will be emitted. // the signal filesAdded("trash:/") will be emitted.
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory)); requestDelayedItemInfo(KFileItem(KUrl(directory)));
requestDelayedItemInfo(item);
} }
} }

View file

@ -113,7 +113,7 @@ void StartupSettingsPage::applySettings()
GeneralSettings* settings = GeneralSettings::self(); GeneralSettings* settings = GeneralSettings::self();
const KUrl url(m_homeUrl->text()); const KUrl url(m_homeUrl->text());
KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url); KFileItem fileItem(url);
if (url.isValid() && fileItem.isDir()) { if (url.isValid() && fileItem.isDir()) {
settings->setHomeUrl(url.prettyUrl()); settings->setHomeUrl(url.prettyUrl());
} else { } else {

View file

@ -1607,7 +1607,7 @@ void DolphinView::updateWritableState()
if (item.isNull()) { if (item.isNull()) {
// Try to find out if the URL is writable even if the "root item" is // Try to find out if the URL is writable even if the "root item" is
// null, see https://bugs.kde.org/show_bug.cgi?id=330001 // null, see https://bugs.kde.org/show_bug.cgi?id=330001
item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url()); item = KFileItem(url());
} }
KFileItemListProperties capabilities(KFileItemList() << item); KFileItemListProperties capabilities(KFileItemList() << item);

View file

@ -660,7 +660,7 @@ void KateMainWindow::slotDropEvent( QDropEvent * event )
for (KUrl::List::Iterator i = textlist.begin(); i != textlist.end(); ++i) for (KUrl::List::Iterator i = textlist.begin(); i != textlist.end(); ++i)
{ {
// if url has no file component, try and recursively scan dir // if url has no file component, try and recursively scan dir
KFileItem kitem( KFileItem::Unknown, KFileItem::Unknown, *i ); KFileItem kitem(*i );
if( kitem.isDir() ) { if( kitem.isDir() ) {
KIO::ListJob *list_job = KIO::listRecursive(*i, KIO::DefaultFlags, false); KIO::ListJob *list_job = KIO::listRecursive(*i, KIO::DefaultFlags, false);
connect(list_job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), connect(list_job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),

View file

@ -280,8 +280,7 @@ void Autostart::slotEditCMD(QTreeWidgetItem* ent)
if (!ent) return; if (!ent) return;
AutoStartItem *entry = dynamic_cast<AutoStartItem*>( ent ); AutoStartItem *entry = dynamic_cast<AutoStartItem*>( ent );
if (entry) { if (entry) {
const KFileItem kfi = KFileItem( KFileItem::Unknown, KFileItem::Unknown, KUrl(entry->fileName())); if (!slotEditCMD(KFileItem(KUrl(entry->fileName())))) {
if (!slotEditCMD(kfi)) {
return; return;
} }

View file

@ -576,7 +576,7 @@ static int directCommand(KCmdLineArgs *args)
// copied from KFileDialog::getSaveFileName(), so we can add geometry // copied from KFileDialog::getSaveFileName(), so we can add geometry
bool specialDir = ( startDir.at(0) == ':' ); bool specialDir = ( startDir.at(0) == ':' );
if ( !specialDir ) { if ( !specialDir ) {
KFileItem kfi(KFileItem::Unknown, KFileItem::Unknown, KUrl(startDir)); KFileItem kfi = KFileItem(KUrl(startDir));
specialDir = kfi.isDir(); specialDir = kfi.isDir();
} }
KFileDialog dlg( specialDir ? startDir : QString(), filter, 0 ); KFileDialog dlg( specialDir ? startDir : QString(), filter, 0 );

View file

@ -320,7 +320,7 @@ void KServiceListWidget::editService()
// path from KStandardDirs. // path from KStandardDirs.
path = KStandardDirs::locate("apps", path); // TODO use xdgdata-apps instead? path = KStandardDirs::locate("apps", path); // TODO use xdgdata-apps instead?
KFileItem item(KUrl(path), "application/x-desktop", KFileItem::Unknown); KFileItem item = KFileItem(KUrl(path));
KPropertiesDialog dlg(item, this); KPropertiesDialog dlg(item, this);
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted)
return; return;

View file

@ -170,7 +170,7 @@ void KQuery::slotListEntries( QStringList list )
m_foundFilesList.clear(); m_foundFilesList.clear();
for (; it != end; ++it) for (; it != end; ++it)
processQuery( KFileItem( KFileItem::Unknown, KFileItem::Unknown, KUrl(*it)) ); processQuery( KFileItem(KUrl(*it)) );
if( m_foundFilesList.size() > 0 ) if( m_foundFilesList.size() > 0 )
emit foundFileList( m_foundFilesList ); emit foundFileList( m_foundFilesList );

View file

@ -514,9 +514,8 @@ bool TrashImpl::synchronousDel( const QString& path, bool setLastErrorCode, bool
// otherwise we won't be able to delete files in them (#130780). // otherwise we won't be able to delete files in them (#130780).
if ( isDir ) { if ( isDir ) {
kDebug() << "chmod'ing " << url; kDebug() << "chmod'ing " << url;
KFileItem fileItem( url, QString::fromLatin1("inode/directory"), KFileItem::Unknown );
KFileItemList fileItemList; KFileItemList fileItemList;
fileItemList.append( fileItem ); fileItemList.append( KFileItem(url) );
KIO::ChmodJob* chmodJob = KIO::chmod( fileItemList, 0200, 0200, QString(), QString(), true /*recursive*/, KIO::HideProgressInfo ); KIO::ChmodJob* chmodJob = KIO::chmod( fileItemList, 0200, 0200, QString(), QString(), true /*recursive*/, KIO::HideProgressInfo );
connect( chmodJob, SIGNAL( result(KJob *) ), connect( chmodJob, SIGNAL( result(KJob *) ),
this, SLOT( jobFinished(KJob *) ) ); this, SLOT( jobFinished(KJob *) ) );

View file

@ -572,10 +572,7 @@ void KonqOperations::doDropFileCopy()
//now initialize the drop plugins //now initialize the drop plugins
KFileItemList fileItems; KFileItemList fileItems;
foreach(const KUrl& url, lst) { foreach(const KUrl& url, lst) {
fileItems.append(KFileItem( fileItems.append(KFileItem(url));
KFileItem::Unknown,
KFileItem::Unknown,
url));
} }
@ -959,11 +956,11 @@ QPair<bool, QString> KonqOperations::pasteInfo(const KUrl& targetUrl)
if (!urls.isEmpty() || canPasteData) { if (!urls.isEmpty() || canPasteData) {
// disable the paste action if no writing is supported // disable the paste action if no writing is supported
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, targetUrl); ;
ret.first = KFileItemListProperties(KFileItemList() << item).supportsWriting(); ret.first = KFileItemListProperties(KFileItemList() << KFileItem(targetUrl)).supportsWriting();
if (urls.count() == 1) { if (urls.count() == 1) {
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first()); const KFileItem item(urls.first());
ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") : ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") :
i18nc("@action:inmenu", "Paste One File"); i18nc("@action:inmenu", "Paste One File");

View file

@ -197,9 +197,8 @@ void KonqPopupMenuTest::testFileInReadOnlyDirectory()
QSKIP("/etc/passwd file is writable", SkipSingle); QSKIP("/etc/passwd file is writable", SkipSingle);
} }
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(notwritablefile));
KFileItemList itemList; KFileItemList itemList;
itemList << item; itemList << KFileItem(KUrl(notwritablefile));
KFileItemListProperties capabilities(itemList); KFileItemListProperties capabilities(itemList);
QVERIFY(!capabilities.supportsMoving()); QVERIFY(!capabilities.supportsMoving());

View file

@ -54,7 +54,7 @@ void AsyncFileTester::checkIfFolder(const QModelIndex &index, QObject *object, c
if (file.readType() == "Link") { if (file.readType() == "Link") {
url = file.readUrl(); url = file.readUrl();
if (url.isLocalFile()) { if (url.isLocalFile()) {
KFileItem destItem(KFileItem::Unknown, KFileItem::Unknown, url); KFileItem destItem(url);
callResultMethod(object, method, index, destItem.isDir()); callResultMethod(object, method, index, destItem.isDir());
return; return;
} }

View file

@ -1749,8 +1749,7 @@ QList<QAction*> FolderView::contextualActions()
// Create a new KFileItem to prevent the target URL in the root item // Create a new KFileItem to prevent the target URL in the root item
// from being used. In this case we want the configured URL instead. // from being used. In this case we want the configured URL instead.
KFileItem item(rootItem.mode(), rootItem.permissions(), m_url); KFileItemListProperties itemList(KFileItemList() << KFileItem(m_url));
KFileItemListProperties itemList(KFileItemList() << item);
m_itemActions->setItemListProperties(itemList); m_itemActions->setItemListProperties(itemList);
// FIXME: The actions instanciated by KFileItemActions::preferredOpenWithAction() // FIXME: The actions instanciated by KFileItemActions::preferredOpenWithAction()

View file

@ -591,9 +591,7 @@ void PopupView::contextMenuEvent(QContextMenuEvent *event)
if (!m_itemActions) { if (!m_itemActions) {
// Create a new KFileItem to prevent the target URL in the root item // Create a new KFileItem to prevent the target URL in the root item
// from being used. In this case we want the configured URL instead. // from being used. In this case we want the configured URL instead.
KFileItem item(rootItem.mode(), rootItem.permissions(), m_url); KFileItemListProperties itemList(KFileItemList() << KFileItem(m_url));
KFileItemListProperties itemList(KFileItemList() << item);
m_itemActions = new KFileItemActions(this); m_itemActions = new KFileItemActions(this);
m_itemActions->setItemListProperties(itemList); m_itemActions->setItemListProperties(itemList);

View file

@ -160,7 +160,7 @@ void IconApplet::setUrl(const KUrl& url, bool fromConfigDialog)
connect(m_watcher, SIGNAL(dirty(QString)), this, SLOT(delayedDestroy())); connect(m_watcher, SIGNAL(dirty(QString)), this, SLOT(delayedDestroy()));
QFileInfo fi(m_url.toLocalFile()); QFileInfo fi(m_url.toLocalFile());
KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, m_url.toLocalFile()); KFileItem fileItem(m_url.toLocalFile());
if (fileItem.isDesktopFile()) { if (fileItem.isDesktopFile()) {
m_hasDesktopFile = true; m_hasDesktopFile = true;

View file

@ -216,7 +216,7 @@ QVariant BackgroundListModel::data(const QModelIndex &index, int role) const
KUrl file(b->filePath("preferred")); KUrl file(b->filePath("preferred"));
if (!m_previewJobs.contains(file) && file.isValid()) { if (!m_previewJobs.contains(file) && file.isValid()) {
KFileItemList list; KFileItemList list;
list.append(KFileItem(file, QString(), 0)); list.append(KFileItem(file));
KIO::PreviewJob* job = KIO::filePreview(list, KIO::PreviewJob* job = KIO::filePreview(list,
QSize(BackgroundDelegate::SCREENSHOT_SIZE, QSize(BackgroundDelegate::SCREENSHOT_SIZE,
BackgroundDelegate::SCREENSHOT_SIZE/1.6)); BackgroundDelegate::SCREENSHOT_SIZE/1.6));