Consistently use non-deprecated UDSEntry fastInsert/replace API

parent f77636bf
......@@ -102,14 +102,14 @@ public:
{
KIO::UDSEntry uds;
KActivities::Info activityInfo(activity);
uds.insert(KIO::UDSEntry::UDS_NAME, activity);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, activityInfo.name());
uds.insert(KIO::UDSEntry::UDS_DISPLAY_TYPE, i18n("Activity"));
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, activityInfo.icon());
uds.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.insert(KIO::UDSEntry::UDS_ACCESS, 0500);
uds.insert(KIO::UDSEntry::UDS_USER, KUser().loginName());
uds.fastInsert(KIO::UDSEntry::UDS_NAME, activity);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, activityInfo.name());
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_TYPE, i18n("Activity"));
uds.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, activityInfo.icon());
uds.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.fastInsert(KIO::UDSEntry::UDS_ACCESS, 0500);
uds.fastInsert(KIO::UDSEntry::UDS_USER, KUser().loginName());
return uds;
}
......@@ -129,10 +129,10 @@ public:
auto mangled = mangledPath(path);
// QProcess::execute("kdialog", { "--passivepopup", mangled });
uds.insert(KIO::UDSEntry::UDS_NAME, mangled);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, url.fileName());
uds.insert(KIO::UDSEntry::UDS_TARGET_URL, url.url());
uds.insert(KIO::UDSEntry::UDS_LOCAL_PATH, path);
uds.replace(KIO::UDSEntry::UDS_NAME, mangled);
uds.replace(KIO::UDSEntry::UDS_DISPLAY_NAME, url.fileName());
uds.replace(KIO::UDSEntry::UDS_TARGET_URL, url.url());
uds.replace(KIO::UDSEntry::UDS_LOCAL_PATH, path);
return uds;
}
......@@ -224,15 +224,15 @@ void ActivitiesProtocol::listDir(const QUrl &url)
KIO::UDSEntryList udslist;
KIO::UDSEntry uds;
uds.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral("current"));
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Current activity"));
uds.insert(KIO::UDSEntry::UDS_DISPLAY_TYPE, i18n("Activity"));
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("preferences-activities"));
uds.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.insert(KIO::UDSEntry::UDS_ACCESS, 0500);
uds.insert(KIO::UDSEntry::UDS_USER, KUser().loginName());
uds.insert(KIO::UDSEntry::UDS_TARGET_URL, QStringLiteral("activities:/") + activities.currentActivity());
uds.fastInsert(KIO::UDSEntry::UDS_NAME, QStringLiteral("current"));
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Current activity"));
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_TYPE, i18n("Activity"));
uds.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("preferences-activities"));
uds.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.fastInsert(KIO::UDSEntry::UDS_ACCESS, 0500);
uds.fastInsert(KIO::UDSEntry::UDS_USER, KUser().loginName());
uds.fastInsert(KIO::UDSEntry::UDS_TARGET_URL, QStringLiteral("activities:/") + activities.currentActivity());
udslist << uds;
for (const auto activity: activities.activities()) {
......@@ -305,12 +305,12 @@ void ActivitiesProtocol::stat(const QUrl& url)
{
QString dirName = i18n("Activities");
KIO::UDSEntry uds;
uds.insert(KIO::UDSEntry::UDS_NAME, dirName);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, dirName);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_TYPE, dirName);
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("preferences-activities"));
uds.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
uds.fastInsert(KIO::UDSEntry::UDS_NAME, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_TYPE, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("preferences-activities"));
uds.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
statEntry(uds);
finished();
......
......@@ -176,25 +176,25 @@ bool ArchiveProtocolBase::checkNewFile( const QUrl & url, QString & path, KIO::E
void ArchiveProtocolBase::createRootUDSEntry( KIO::UDSEntry & entry )
{
entry.clear();
entry.insert( KIO::UDSEntry::UDS_NAME, "." );
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, m_mtime );
//entry.insert( KIO::UDSEntry::UDS_ACCESS, 07777 ); // fake 'x' permissions, this is a pseudo-directory
entry.insert( KIO::UDSEntry::UDS_USER, m_user);
entry.insert( KIO::UDSEntry::UDS_GROUP, m_group);
entry.fastInsert( KIO::UDSEntry::UDS_NAME, "." );
entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
entry.fastInsert( KIO::UDSEntry::UDS_MODIFICATION_TIME, m_mtime );
//entry.fastInsert( KIO::UDSEntry::UDS_ACCESS, 07777 ); // fake 'x' permissions, this is a pseudo-directory
entry.fastInsert( KIO::UDSEntry::UDS_USER, m_user);
entry.fastInsert( KIO::UDSEntry::UDS_GROUP, m_group);
}
void ArchiveProtocolBase::createUDSEntry( const KArchiveEntry * archiveEntry, UDSEntry & entry )
{
entry.clear();
entry.insert( KIO::UDSEntry::UDS_NAME, archiveEntry->name() );
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, archiveEntry->permissions() & S_IFMT ); // keep file type only
entry.insert( KIO::UDSEntry::UDS_SIZE, archiveEntry->isFile() ? ((KArchiveFile *)archiveEntry)->size() : 0L );
entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, archiveEntry->date().toTime_t());
entry.insert( KIO::UDSEntry::UDS_ACCESS, archiveEntry->permissions() & 07777 ); // keep permissions only
entry.insert( KIO::UDSEntry::UDS_USER, archiveEntry->user());
entry.insert( KIO::UDSEntry::UDS_GROUP, archiveEntry->group());
entry.insert( KIO::UDSEntry::UDS_LINK_DEST, archiveEntry->symLinkTarget());
entry.fastInsert( KIO::UDSEntry::UDS_NAME, archiveEntry->name() );
entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, archiveEntry->permissions() & S_IFMT ); // keep file type only
entry.fastInsert( KIO::UDSEntry::UDS_SIZE, archiveEntry->isFile() ? ((KArchiveFile *)archiveEntry)->size() : 0L );
entry.fastInsert( KIO::UDSEntry::UDS_MODIFICATION_TIME, archiveEntry->date().toTime_t());
entry.fastInsert( KIO::UDSEntry::UDS_ACCESS, archiveEntry->permissions() & 07777 ); // keep permissions only
entry.fastInsert( KIO::UDSEntry::UDS_USER, archiveEntry->user());
entry.fastInsert( KIO::UDSEntry::UDS_GROUP, archiveEntry->group());
entry.fastInsert( KIO::UDSEntry::UDS_LINK_DEST, archiveEntry->symLinkTarget());
}
void ArchiveProtocolBase::listDir( const QUrl & url )
......@@ -315,7 +315,7 @@ void ArchiveProtocolBase::stat( const QUrl & url )
return;
}
// Real directory. Return just enough information for KRun to work
entry.insert( KIO::UDSEntry::UDS_NAME, url.fileName());
entry.fastInsert( KIO::UDSEntry::UDS_NAME, url.fileName());
qCDebug(KIO_ARCHIVE_LOG).nospace() << "ArchiveProtocolBase::stat returning name=" << url.fileName();
QT_STATBUF buff;
......@@ -332,7 +332,7 @@ void ArchiveProtocolBase::stat( const QUrl & url )
return;
}
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, buff.st_mode & S_IFMT);
entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, buff.st_mode & S_IFMT);
statEntry( entry );
......
......@@ -101,7 +101,7 @@ void FileNameSearchProtocol::searchDirectory(const QUrl &directory,
foreach (const KFileItem &item, items) {
if (itemValidator(item)) {
KIO::UDSEntry entry = item.entry();
entry.insert(KIO::UDSEntry::UDS_URL, item.url().url());
entry.replace(KIO::UDSEntry::UDS_URL, item.url().url());
listEntry(entry);
}
......
......@@ -947,15 +947,15 @@ void fishProtocol::manageConnection(const QString &l) {
if (line[9] == 'w') accessVal |= S_IWOTH;
if (line[10] == 'x' || line[10] == 't') accessVal |= S_IXOTH;
if (line[10] == 'T' || line[10] == 't') accessVal |= S_ISVTX;
udsEntry.insert(KIO::UDSEntry::UDS_ACCESS, accessVal);
udsEntry.replace(KIO::UDSEntry::UDS_ACCESS, accessVal);
pos = line.indexOf(':',12);
if (pos < 0) {
errorCount++;
break;
}
udsEntry.insert(KIO::UDSEntry::UDS_USER, line.mid(12,pos-12));
udsEntry.insert(KIO::UDSEntry::UDS_GROUP, line.mid(pos+1));
udsEntry.replace(KIO::UDSEntry::UDS_USER, line.mid(12,pos-12));
udsEntry.replace(KIO::UDSEntry::UDS_GROUP, line.mid(pos+1));
}
break;
......@@ -964,8 +964,8 @@ void fishProtocol::manageConnection(const QString &l) {
pos2 = line.indexOf(' ',pos+1);
if (pos < 0 || pos2 < 0) break;
errorCount--;
udsEntry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME,
makeTimeFromLs(line.mid(1,pos-1), line.mid(pos+1,pos2-pos), line.mid(pos2+1)));
udsEntry.replace(KIO::UDSEntry::UDS_MODIFICATION_TIME,
makeTimeFromLs(line.mid(1,pos-1), line.mid(pos+1,pos2-pos), line.mid(pos2+1)));
break;
case 'D':
......@@ -980,7 +980,7 @@ void fishProtocol::manageConnection(const QString &l) {
if (pos < 0 || pos2 < 0 || pos3 < 0) break;
dt.setTime(QTime(line.mid(pos+1,pos2-pos-1).toInt(),line.mid(pos2+1,pos3-pos2-1).toInt(),line.mid(pos3+1).toInt()));
errorCount--;
udsEntry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, dt.toTime_t());
udsEntry.replace(KIO::UDSEntry::UDS_MODIFICATION_TIME, dt.toTime_t());
break;
case 'S':
......@@ -988,7 +988,7 @@ void fishProtocol::manageConnection(const QString &l) {
long long sizeVal = line.mid(1).toLongLong(&isOk);
if (!isOk) break;
errorCount--;
udsEntry.insert(KIO::UDSEntry::UDS_SIZE, sizeVal);
udsEntry.replace(KIO::UDSEntry::UDS_SIZE, sizeVal);
}
break;
......@@ -1000,7 +1000,7 @@ void fishProtocol::manageConnection(const QString &l) {
pos = line.lastIndexOf('/');
thisFn = line.mid(pos < 0?1:pos+1);
if (fishCommand == FISH_LIST) {
udsEntry.insert(KIO::UDSEntry::UDS_NAME, thisFn);
udsEntry.replace(KIO::UDSEntry::UDS_NAME, thisFn);
}
// By default, the mimetype comes from the extension
// We'll use the file(1) result only as fallback [like the rest of KDE does]
......@@ -1028,17 +1028,17 @@ void fishProtocol::manageConnection(const QString &l) {
break;
case 'L':
udsEntry.insert(KIO::UDSEntry::UDS_LINK_DEST, line.mid(1));
udsEntry.replace(KIO::UDSEntry::UDS_LINK_DEST, line.mid(1));
if (!udsType) udsType = S_IFLNK;
errorCount--;
break;
}
} else {
if (!udsMime.isNull())
udsEntry.insert(KIO::UDSEntry::UDS_MIME_TYPE, udsMime);
udsEntry.replace(KIO::UDSEntry::UDS_MIME_TYPE, udsMime);
udsMime.clear();
udsEntry.insert( KIO::UDSEntry::UDS_FILE_TYPE, udsType );
udsEntry.replace( KIO::UDSEntry::UDS_FILE_TYPE, udsType );
udsType = 0;
if (fishCommand == FISH_STAT)
......@@ -1186,7 +1186,7 @@ void fishProtocol::manageConnection(const QString &l) {
return; // Don't call finished!
}
} else if (fishCommand == FISH_STAT) {
udsStatEntry.insert( KIO::UDSEntry::UDS_NAME, url.fileName() );
udsStatEntry.replace( KIO::UDSEntry::UDS_NAME, url.fileName() );
statEntry(udsStatEntry);
} else if (fishCommand == FISH_APPEND) {
dataReq();
......
......@@ -235,10 +235,10 @@ void InfoProtocol::stat( const QUrl & )
#ifdef Q_OS_WIN
// Regular file with rwx permission for all
uds_entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG );
uds_entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG );
#else
// Regular file with rwx permission for all
uds_entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO );
uds_entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO );
#endif
statEntry( uds_entry );
......
......@@ -279,32 +279,32 @@ void NetworkSlave::listDir( const QUrl& url )
void NetworkSlave::feedEntryAsNetwork( KIO::UDSEntry* entry )
{
entry->insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
// entry->insert( KIO::UDSEntry::UDS_ICON_NAME, NetworkIconName );
entry->insert( KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(Mimetypes::NetworkMimetype) );
entry->fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
// entry->fastInsert( KIO::UDSEntry::UDS_ICON_NAME, NetworkIconName );
entry->fastInsert( KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(Mimetypes::NetworkMimetype) );
}
void NetworkSlave::feedEntryAsDevice( KIO::UDSEntry* entry, const Mollet::NetDevice& deviceData )
{
entry->insert( KIO::UDSEntry::UDS_NAME, deviceData.hostAddress() );
entry->insert( KIO::UDSEntry::UDS_DISPLAY_NAME, deviceData.name() );
entry->insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
// entry->insert( KIO::UDSEntry::UDS_ICON_NAME, NetDevice::iconName(deviceData.type()) );
entry->insert( KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(Mimetypes::DeviceMimetype[deviceData.type()]) );
entry->fastInsert( KIO::UDSEntry::UDS_NAME, deviceData.hostAddress() );
entry->fastInsert( KIO::UDSEntry::UDS_DISPLAY_NAME, deviceData.name() );
entry->fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
// entry->fastInsert( KIO::UDSEntry::UDS_ICON_NAME, NetDevice::iconName(deviceData.type()) );
entry->fastInsert( KIO::UDSEntry::UDS_MIME_TYPE, QLatin1String(Mimetypes::DeviceMimetype[deviceData.type()]) );
}
void NetworkSlave::feedEntryAsService( KIO::UDSEntry* entry, const Mollet::NetService& serviceData )
{
entry->insert( KIO::UDSEntry::UDS_NAME, serviceData.name()+QLatin1Char('.')+serviceData.type() );
entry->insert( KIO::UDSEntry::UDS_DISPLAY_NAME, serviceData.name() );
entry->insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFLNK );
entry->insert( KIO::UDSEntry::UDS_ACCESS, S_IRWXU|S_IRWXG|S_IRWXO );
entry->insert( KIO::UDSEntry::UDS_ICON_NAME, serviceData.iconName() );
entry->insert( KIO::UDSEntry::UDS_MIME_TYPE, Mimetypes::mimetypeForServiceType(serviceData.type()) );
entry->fastInsert( KIO::UDSEntry::UDS_NAME, serviceData.name()+QLatin1Char('.')+serviceData.type() );
entry->fastInsert( KIO::UDSEntry::UDS_DISPLAY_NAME, serviceData.name() );
entry->fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFLNK );
entry->fastInsert( KIO::UDSEntry::UDS_ACCESS, S_IRWXU|S_IRWXG|S_IRWXO );
entry->fastInsert( KIO::UDSEntry::UDS_ICON_NAME, serviceData.iconName() );
entry->fastInsert( KIO::UDSEntry::UDS_MIME_TYPE, Mimetypes::mimetypeForServiceType(serviceData.type()) );
if( !serviceData.url().isEmpty() )
entry->insert( KIO::UDSEntry::UDS_TARGET_URL, serviceData.url() );
entry->fastInsert( KIO::UDSEntry::UDS_TARGET_URL, serviceData.url() );
}
void NetworkSlave::reportError( const NetworkUri& networkUri, int errorId )
......
......@@ -98,16 +98,16 @@ void RecentDocuments::listDir(const QUrl& url)
}
urlSet.insert(toDisplayString);
uds.insert(KIO::UDSEntry::UDS_NAME, info.completeBaseName());
uds.replace(KIO::UDSEntry::UDS_NAME, info.completeBaseName());
if (urlInside.isLocalFile()) {
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, urlInside.toLocalFile());
uds.insert(KIO::UDSEntry::UDS_LOCAL_PATH, urlInside.path());
uds.replace(KIO::UDSEntry::UDS_DISPLAY_NAME, urlInside.toLocalFile());
uds.replace(KIO::UDSEntry::UDS_LOCAL_PATH, urlInside.path());
} else {
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, toDisplayString);
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, file.readIcon());
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, toDisplayString);
uds.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, file.readIcon());
}
uds.insert(KIO::UDSEntry::UDS_TARGET_URL, toDisplayString);
uds.replace(KIO::UDSEntry::UDS_TARGET_URL, toDisplayString);
udslist << uds;
}
}
......@@ -148,12 +148,12 @@ void RecentDocuments::stat(const QUrl& url)
//
QString dirName = i18n("Recent Documents");
KIO::UDSEntry uds;
uds.insert(KIO::UDSEntry::UDS_NAME, dirName);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, dirName);
uds.insert(KIO::UDSEntry::UDS_DISPLAY_TYPE, dirName);
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, QString::fromLatin1("document-open-recent"));
uds.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.insert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("inode/directory"));
uds.fastInsert(KIO::UDSEntry::UDS_NAME, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_DISPLAY_TYPE, dirName);
uds.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, QString::fromLatin1("document-open-recent"));
uds.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
uds.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("inode/directory"));
statEntry(uds);
finished();
......
......@@ -63,25 +63,25 @@ extern "C" {
static void createFileEntry(KIO::UDSEntry& entry, const KService::Ptr& service)
{
entry.clear();
entry.insert(KIO::UDSEntry::UDS_NAME, KIO::encodeFileName(service->desktopEntryName()));
entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name()); // translated name
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
entry.insert(KIO::UDSEntry::UDS_ACCESS, 0500);
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, "application/x-desktop");
entry.insert(KIO::UDSEntry::UDS_SIZE, 0);
entry.insert(KIO::UDSEntry::UDS_LOCAL_PATH, QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kservices5/") + service->entryPath()));
entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, time(nullptr));
entry.insert(KIO::UDSEntry::UDS_ICON_NAME, service->icon());
entry.fastInsert(KIO::UDSEntry::UDS_NAME, KIO::encodeFileName(service->desktopEntryName()));
entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name()); // translated name
entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
entry.fastInsert(KIO::UDSEntry::UDS_ACCESS, 0500);
entry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, "application/x-desktop");
entry.fastInsert(KIO::UDSEntry::UDS_SIZE, 0);
entry.fastInsert(KIO::UDSEntry::UDS_LOCAL_PATH, QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kservices5/") + service->entryPath()));
entry.fastInsert(KIO::UDSEntry::UDS_MODIFICATION_TIME, time(nullptr));
entry.fastInsert(KIO::UDSEntry::UDS_ICON_NAME, service->icon());
}
static void createDirEntry(KIO::UDSEntry& entry, const QString& name, const QString& iconName)
{
entry.clear();
entry.insert( KIO::UDSEntry::UDS_NAME, name );
entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
entry.insert( KIO::UDSEntry::UDS_ACCESS, 0500 );
entry.insert( KIO::UDSEntry::UDS_MIME_TYPE, "inode/directory" );
entry.insert( KIO::UDSEntry::UDS_ICON_NAME, iconName );
entry.fastInsert( KIO::UDSEntry::UDS_NAME, name );
entry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
entry.fastInsert( KIO::UDSEntry::UDS_ACCESS, 0500 );
entry.fastInsert( KIO::UDSEntry::UDS_MIME_TYPE, "inode/directory" );
entry.fastInsert( KIO::UDSEntry::UDS_ICON_NAME, iconName );
}
SettingsProtocol::SettingsProtocol( const QByteArray &protocol, const QByteArray &pool, const QByteArray &app)
......@@ -141,7 +141,7 @@ void SettingsProtocol::stat(const QUrl& url)
const QString category = service->property("X-KDE-System-Settings-Category").toString();
//qDebug() << "category" << service->desktopEntryName() << service->name() << "category=" << category << "parentCategory=" << parentCategory;
createDirEntry(entry, category, service->icon());
entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name());
entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name());
statEntry(entry);
finished();
return;
......@@ -182,7 +182,7 @@ void SettingsProtocol::listDir(const QUrl& url)
//KUrl dirUrl = url;
//dirUrl.addPath(category);
createDirEntry(entry, category, service->icon());
entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name());
entry.fastInsert(KIO::UDSEntry::UDS_DISPLAY_NAME, service->name());
listEntry(entry);
++count;
}
......
......@@ -77,8 +77,8 @@ int SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry)
return EINVAL;
}
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, st.st_mode & S_IFMT);
udsentry.insert(KIO::UDSEntry::UDS_SIZE, st.st_size);
udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, st.st_mode & S_IFMT);
udsentry.fastInsert(KIO::UDSEntry::UDS_SIZE, st.st_size);
QString str;
uid_t uid = st.st_uid;
......@@ -87,7 +87,7 @@ int SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry)
str = user->pw_name;
else
str = QString::number( uid );
udsentry.insert(KIO::UDSEntry::UDS_USER, str);
udsentry.fastInsert(KIO::UDSEntry::UDS_USER, str);
gid_t gid = st.st_gid;
struct group *grp = getgrgid( gid );
......@@ -95,11 +95,11 @@ int SMBSlave::browse_stat_path(const SMBUrl& _url, UDSEntry& udsentry)
str = grp->gr_name;
else
str = QString::number( gid );
udsentry.insert(KIO::UDSEntry::UDS_GROUP, str);
udsentry.fastInsert(KIO::UDSEntry::UDS_GROUP, str);
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, st.st_mode & 07777);
udsentry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, st.st_mtime);
udsentry.insert(KIO::UDSEntry::UDS_ACCESS_TIME, st.st_atime);
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, st.st_mode & 07777);
udsentry.fastInsert(KIO::UDSEntry::UDS_MODIFICATION_TIME, st.st_mtime);
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS_TIME, st.st_atime);
// No, st_ctime is not UDS_CREATION_TIME...
}
......@@ -126,7 +126,7 @@ void SMBSlave::stat( const QUrl& kurl )
UDSEntry udsentry;
// Set name
udsentry.insert( KIO::UDSEntry::UDS_NAME, kurl.fileName() );
udsentry.fastInsert( KIO::UDSEntry::UDS_NAME, kurl.fileName() );
switch(m_current_url.getType())
{
......@@ -136,7 +136,7 @@ void SMBSlave::stat( const QUrl& kurl )
case SMBURLTYPE_ENTIRE_NETWORK:
case SMBURLTYPE_WORKGROUP_OR_SERVER:
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
break;
case SMBURLTYPE_SHARE_OR_PATH:
......@@ -363,12 +363,12 @@ void SMBSlave::listDir( const QUrl& kurl )
qCDebug(KIO_SMB) << "dirp->name " << dirp->name << " " << dirpName << " '" << comment << "'" << " " << dirp->smbc_type;
udsentry.insert( KIO::UDSEntry::UDS_NAME, udsName );
udsentry.fastInsert( KIO::UDSEntry::UDS_NAME, udsName );
// Mark all administrative shares, e.g ADMIN$, as hidden. #197903
if (dirpName.endsWith(QLatin1Char('$'))) {
//qCDebug(KIO_SMB) << dirpName << "marked as hidden";
udsentry.insert(KIO::UDSEntry::UDS_HIDDEN, 1);
udsentry.fastInsert(KIO::UDSEntry::UDS_HIDDEN, 1);
}
if (udsName == ".")
......@@ -406,11 +406,11 @@ void SMBSlave::listDir( const QUrl& kurl )
dirp->smbc_type == SMBC_FILE_SHARE)
{
// Set type
udsentry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
udsentry.fastInsert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR );
if (dirp->smbc_type == SMBC_SERVER) {
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH));
// QString workgroup = m_current_url.host().toUpper();
QUrl u("smb://");
......@@ -419,11 +419,11 @@ void SMBSlave::listDir( const QUrl& kurl )
// when libsmbclient knows
// u = QString("smb://%1?WORKGROUP=%2").arg(dirpName).arg(workgroup.toUpper());
qCDebug(KIO_SMB) << "list item " << u;
udsentry.insert(KIO::UDSEntry::UDS_URL, u.url());
udsentry.fastInsert(KIO::UDSEntry::UDS_URL, u.url());
udsentry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("application/x-smb-server"));
udsentry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("application/x-smb-server"));
} else
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
// Call base class to list entry
......@@ -432,17 +432,17 @@ void SMBSlave::listDir( const QUrl& kurl )
else if(dirp->smbc_type == SMBC_WORKGROUP)
{
// Set type
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
// Set permissions
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH));
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH));
udsentry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("application/x-smb-workgroup"));
udsentry.fastInsert(KIO::UDSEntry::UDS_MIME_TYPE, QString::fromLatin1("application/x-smb-workgroup"));
// QString workgroup = m_current_url.host().toUpper();
QUrl u("smb://");
u.setHost(dirpName);
udsentry.insert(KIO::UDSEntry::UDS_URL, u.url());
udsentry.fastInsert(KIO::UDSEntry::UDS_URL, u.url());
// Call base class to list entry
listEntry(udsentry);
......@@ -461,13 +461,13 @@ void SMBSlave::listDir( const QUrl& kurl )
listDNSSD(udsentry, url, direntCount);
if (dir_is_root) {
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.insert(KIO::UDSEntry::UDS_NAME, ".");
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH));
udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.fastInsert(KIO::UDSEntry::UDS_NAME, ".");
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, (S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH));
}
else
{
udsentry.insert(KIO::UDSEntry::UDS_NAME, ".");
udsentry.fastInsert(KIO::UDSEntry::UDS_NAME, ".");
const int statErr = browse_stat_path(m_current_url, udsentry);
if (statErr)
{
......@@ -476,8 +476,8 @@ void SMBSlave::listDir( const QUrl& kurl )
reportWarning(m_current_url, statErr);
}
// Create a default UDSEntry if we could not stat the actual directory
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
udsentry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.fastInsert(KIO::UDSEntry::UDS_ACCESS, (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
}
}
listEntry(udsentry);
......
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