本文整理汇总了C++中KUrl::fileEncoding方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::fileEncoding方法的具体用法?C++ KUrl::fileEncoding怎么用?C++ KUrl::fileEncoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KUrl
的用法示例。
在下文中一共展示了KUrl::fileEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateCurrentPage
//.........这里部分代码省略.........
updateParametersPageStatus();
}else{
button(BackButton)->setEnabled(false);
button(FinishButton)->setEnabled(false);
KUrl url;
if (_type == "WebFolder") {
if (_useEncryption->isChecked()) {
url.setProtocol("webdavs");
} else {
url.setProtocol("webdav");
}
url.setPort(_port->value());
} else if (_type == "Fish") {
KConfig config("kio_fishrc");
KConfigGroup cg(&config, _host->text().trimmed());
cg.writeEntry("Charset", KCharsets::charsets()->encodingForName(_encoding->currentText()));
url.setProtocol(_protocolText->currentText());
url.setPort(_port->value());
} else if (_type == "FTP") {
url.setProtocol("ftp");
url.setPort(_port->value());
KConfig config("kio_ftprc");
KConfigGroup cg(&config, _host->text().trimmed());
cg.writeEntry("Charset", KCharsets::charsets()->encodingForName(_encoding->currentText()));
config.sync();
} else if (_type == "SMB") {
url.setProtocol("smb");
} else { // recent
}
url.setHost(_host->text().trimmed());
url.setUser(_user->text().trimmed());
QString path = _path->text().trimmed();
#ifndef Q_WS_WIN
// could a relative path really be made absolute by simply prepending a '/' ?
if (!path.startsWith('/')) {
path = QString("/") + path;
}
#endif
url.setPath(path);
_folderParameters->setEnabled(false);
bool success = doConnectionTest(url);
_folderParameters->setEnabled(true);
if (!success) {
KMessageBox::sorry(this, i18n("Unable to connect to server. Please check your settings and try again."));
button(BackButton)->setEnabled(true);
return false;
}
KRun::runUrl(url, "inode/directory", this);
QString name = _connectionName->text().trimmed();
if (_createIcon->isChecked()) {
KGlobal::dirs()->addResourceType("remote_entries", "data", "remoteview");
QString path = KGlobal::dirs()->saveLocation("remote_entries");
path += name + ".desktop";
KConfig _desktopFile( path, KConfig::SimpleConfig );
KConfigGroup desktopFile(&_desktopFile, "Desktop Entry");
desktopFile.writeEntry("Icon", "folder-remote");
desktopFile.writeEntry("Name", name);
desktopFile.writeEntry("Type", "Link");
desktopFile.writeEntry("URL", url.prettyUrl());
desktopFile.writeEntry("Charset", url.fileEncoding());
desktopFile.sync();
org::kde::KDirNotify::emitFilesAdded( QUrl("remote:/") );
}
if (!name.isEmpty()) {
KConfig _recent("krecentconnections", KConfig::NoGlobals);
KConfigGroup recent(&_recent, "General");
QStringList idx = recent.readEntry("Index",QStringList());
_recent.deleteGroup(name); // erase anything stale
if (idx.contains(name)) {
idx.removeAll(name);
idx.prepend(name);
recent.writeEntry("Index", idx);
} else {
QString last;
if (!idx.isEmpty()) {
last = idx.last();
idx.pop_back();
}
idx.prepend(name);
_recent.deleteGroup(last);
recent.writeEntry("Index", idx);
}
recent = KConfigGroup(&_recent,name);
recent.writeEntry("URL", url.prettyUrl());
if (_type == "WebFolder" || _type == "Fish" || _type == "FTP") {
recent.writeEntry("Port", _port->value());
}
recent.writeEntry("Type", _type);
recent.sync();
}
}
return true;
}