本文整理汇总了C++中KUrl::path方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::path方法的具体用法?C++ KUrl::path怎么用?C++ KUrl::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KUrl
的用法示例。
在下文中一共展示了KUrl::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getImage
//static
QPixmap KThumb::getImage(KUrl url, int frame, int width, int height)
{
Mlt::Profile profile(KdenliveSettings::current_profile().toUtf8().constData());
QPixmap pix(width, height);
if (url.isEmpty()) return pix;
//"<mlt><playlist><producer resource=\"" + url.path() + "\" /></playlist></mlt>");
//Mlt::Producer producer(profile, "xml-string", tmp);
Mlt::Producer *producer = new Mlt::Producer(profile, url.path().toUtf8().constData());
double swidth = (double) profile.width() / profile.height();
pix = QPixmap::fromImage(getFrame(producer, frame, (int) (height * swidth + 0.5), width, height));
delete producer;
return pix;
}
示例2: addUrlToRecentFolders
void GvCore::addUrlToRecentFolders(KUrl url)
{
if (!GwenviewConfig::historyEnabled()) {
return;
}
if (!url.isValid()) {
return;
}
if (url.path() != "") { // This check is a workaraound for bug #312060
url.adjustPath(KUrl::AddTrailingSlash);
}
recentFoldersModel();
d->mRecentFoldersModel->addUrl(url);
}
示例3: url
AmarokScriptCodeCompletionModel::AmarokScriptCodeCompletionModel( QObject *parent )
: CodeCompletionModel( parent )
{
const KUrl url( KStandardDirs::locate( "data", "amarok/scriptconsole/" ) );
QFile file( url.path() + "AutoComplete.txt" );
if( file.open( QFile::ReadOnly ) )
{
QTextStream in( &file );
while ( !in.atEnd() )
m_autoCompleteStrings << in.readLine();
}
else
debug() << "No autocomplete file found for the script console";
}
示例4: stat
void Adb::stat( const KUrl& url )
{
qDebug() << "Entering function adb::stat(" << url.path() << ")";
try {
UDSEntry entry=this->getEntry(url);
this->statEntry(entry);
this->finished();
} catch(QString &errorMessage) {
qDebug() << "exception: " << errorMessage;
QStringList strLines = errorMessage.split("|");
this->error(strLines[0].toInt(), errorMessage);
}
}
示例5: push
void HistoryCollection::push(const KUrl &url) //slot
{
if (!url.isEmpty())
{
if (!m_receiver)
{
m_f->clear();
m_receiver = m_b;
}
m_receiver->push(url.path(KUrl::AddTrailingSlash));
}
m_receiver = 0;
}
示例6: searchDirectory
void FileNameSearchProtocol::searchDirectory(const KUrl& directory)
{
// Don't try to iterate the pseudo filesystem directories of Linux
if (directory.path() == QLatin1String("/dev")
|| directory.path() == QLatin1String("/proc")
|| directory.path() == QLatin1String("/sys")) {
return;
}
// Get all items of the directory
KDirLister *dirLister = new KDirLister();
dirLister->setDelayedMimeTypes(false);
dirLister->setAutoErrorHandlingEnabled(false, 0);
dirLister->openUrl(directory);
QEventLoop eventLoop;
QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit()));
QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit()));
eventLoop.exec();
// Visualize all items that match the search pattern
QList<KUrl> pendingDirs;
const KFileItemList items = dirLister->items();
foreach (const KFileItem& item, items) {
bool addItem = false;
if (!m_regExp || item.name().contains(*m_regExp)) {
addItem = true;
if (!m_checkType.isEmpty()) {
addItem = false;
const QStringList types = m_checkType.split(";");
const KSharedPtr<KMimeType> mime = item.determineMimeType();
foreach (const QString& t, types) {
if (mime->is(t)) {
addItem = true;
}
}
}
示例7: openUrl
bool LeaveItemHandler::openUrl(const KUrl& url)
{
m_logoutAction = url.path().remove('/');
if (m_logoutAction == "sleep") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendRAM()));
return true;
} else if (m_logoutAction == "hibernate") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendDisk()));
return true;
} else if (m_logoutAction == "lock") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(lock()));
return true;
} else if (m_logoutAction == "switch") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(switchUser()));
return true;
} else if (m_logoutAction == "logout" || m_logoutAction == "logoutonly" ||
m_logoutAction == "restart" || m_logoutAction == "shutdown") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(logout()));
return true;
} else if (m_logoutAction == "savesession") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(saveSession()));
return true;
} else if (m_logoutAction == "standby") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(standby()));
return true;
} else if (m_logoutAction == "suspendram") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendRAM()));
return true;
} else if (m_logoutAction == "suspenddisk") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(suspendDisk()));
return true;
} else if (m_logoutAction == "run") {
// decouple dbus call, otherwise we'll run into a dead-lock
QTimer::singleShot(0, this, SLOT(runCommand()));
return true;
}
return false;
}
示例8: values
QVariantHash ChooseSamba::values() const
{
QVariantHash ret = m_args;
QString address = ui->addressLE->text().trimmed();
KUrl url;
if (address.startsWith(QLatin1String("//"))) {
url = QLatin1String("smb:") % address;
} else if (address.startsWith(QLatin1String("/"))) {
url = QLatin1String("smb:/") % address;
} else if (address.startsWith(QLatin1String("://"))) {
url = QLatin1String("smb") % address;
} else if (address.startsWith(QLatin1String("smb://"))) {
url = address;
} else if (!KUrl(address).protocol().isEmpty() &&
KUrl(address).protocol() != QLatin1String("smb")) {
url = address;
url.setProtocol(QLatin1String("smb"));
} else {
url = QLatin1String("smb://") % address;
}
kDebug() << 1 << url;
if (!ui->usernameLE->text().isEmpty()) {
url.setUser(ui->usernameLE->text());
}
if (!ui->passwordLE->text().isEmpty()) {
url.setPass(ui->passwordLE->text());
}
kDebug() << 2 << url;
kDebug() << 3 << url.url() << url.path().section(QLatin1Char('/'), -1, -1);// same as url.fileName()
kDebug() << 4 << url.fileName();
kDebug() << 5 << url.host() << url.url().section(QLatin1Char('/'), 3, 3).toLower();
ret[KCUPS_DEVICE_URI] = url.url();
ret[KCUPS_DEVICE_INFO] = url.fileName();
// if there is 4 '/' means the url is like
// smb://group/host/printer, so the location is at a different place
if (url.url().count(QLatin1Char('/') == 4)) {
ret[KCUPS_DEVICE_LOCATION] = url.url().section(QLatin1Char('/'), 3, 3).toLower();
} else {
ret[KCUPS_DEVICE_LOCATION] = url.host();
}
return ret;
}
示例9: splitURL
// The opposite of parseURL
static QString splitURL( int mRealArgType, const KUrl& url )
{
if ( mRealArgType == 33 ) { // LDAP server
// The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
Q_ASSERT( url.protocol() == "ldap" );
return urlpart_encode( url.host() ) + ':' +
( url.port() != -1 ? QString::number( url.port() ) : QString() ) + ':' + // -1 is used for default ports, omit
urlpart_encode( url.user() ) + ':' +
urlpart_encode( url.pass() ) + ':' +
// KUrl automatically encoded the query (e.g. for spaces inside it),
// so decode it before writing it out to gpgconf (issue119)
urlpart_encode( KUrl::fromPercentEncoding( url.query().mid(1).toLatin1() ) );
}
return url.path();
}
示例10: getEntry
UDSEntry Adb::getEntry( const KUrl& url )
{
QStringList arguments;
arguments << "shell";
QString path=this->fillArguments(url.path(), arguments);
arguments << "ls";
arguments << "-la"; // hidden files
arguments << path ; // FIXME: escape ?????
QByteArray read_stdout, read_stderr;
int rc=this->exec(arguments, read_stdout, read_stderr);
qDebug() << "-------------------------- ls -la " << (path+"") << " rc=" << rc << " -------------------";
QStringList fileLines = QString(read_stdout).split("\n");
QString lineFull=this->removeNewline(fileLines[0]);
return this->getEntry(lineFull);
}
示例11: baseMatch
bool baseMatch(const KUrl &url, const QString &protClass) const
{
if (baseProtWildCard)
{
if ( !baseProt.isEmpty() && !url.protocol().startsWith(baseProt) &&
(protClass.isEmpty() || (protClass != baseProt)) )
return false;
}
else
{
if ( (url.protocol() != baseProt) &&
(protClass.isEmpty() || (protClass != baseProt)) )
return false;
}
if (baseHostWildCard)
{
if (!baseHost.isEmpty() && !url.host().endsWith(baseHost))
return false;
}
else
{
if (url.host() != baseHost)
return false;
}
if (basePathWildCard)
{
if (!basePath.isEmpty() && !url.path().startsWith(basePath))
return false;
}
else
{
if (url.path() != basePath)
return false;
}
return true;
}
示例12: while
QString
PixmapCollection::addPixmapPath(const KUrl &url)
{
QString name = url.filename();
while (m_pixmaps.contains(name)) {
bool ok;
int num = name.right(1).toInt(&ok, 10);
if (ok)
name = name.left(name.length() - 1) + QString::number(num + 1);
else
name += "2";
}
m_pixmaps.insert(name, qMakePair(url.path(), 0));
return name;
}
示例13: loadBoard
void Editor::loadBoard()
{
if (!testSave()) {
return;
}
KUrl url = KFileDialog::getOpenUrl(KUrl(), i18n("*.layout|Board Layout (*.layout)\n*|All File"
"s"), this, i18n("Open Board Layout"));
if (url.isEmpty()) {
return;
}
theBoard.loadBoardLayout(url.path());
update();
}
示例14: KDialog
KoFilterChooser::KoFilterChooser(QWidget *parent, const QStringList &mimeTypes, const QString &nativeFormat, const KUrl &url)
: KDialog(parent),
m_mimeTypes(mimeTypes)
{
setObjectName("kofilterchooser");
setInitialSize(QSize(300, 350));
setButtons(KDialog::Ok|KDialog::Cancel);
setDefaultButton(KDialog::Ok);
setCaption(i18n("Choose Filter"));
setModal(true);
QWidget *page = new QWidget(this);
setMainWidget(page);
QVBoxLayout *layout = new QVBoxLayout(page);
if (url.isValid()) {
KSqueezedTextLabel *l = new KSqueezedTextLabel(url.path(), page);
layout->addWidget(l);
}
m_filterList = new QListWidget(page);
layout->addWidget(m_filterList);
page->setLayout(layout);
Q_ASSERT(!m_mimeTypes.isEmpty());
for (QStringList::ConstIterator it = m_mimeTypes.constBegin();
it != m_mimeTypes.constEnd();
it++) {
KMimeType::Ptr mime = KMimeType::mimeType(*it);
const QString name = mime ? mime->comment() : *it;
if (! name.isEmpty())
m_filterList->addItem(name);
}
if (nativeFormat == "application/x-kword") {
const int index = m_mimeTypes.indexOf("text/plain");
if (index > -1)
m_filterList->setCurrentRow(index);
}
if (m_filterList->currentRow() == -1)
m_filterList->setCurrentRow(0);
m_filterList->setFocus();
connect(m_filterList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept()));
resize(QSize(520, 400));//.expandedTo(minimumSizeHint()));
}
示例15: if
void Nepomuk2::TvshowProtocol::stat( const KUrl& url )
{
// for basic functionality we only need to stat the folders
const QStringList pathTokens = url.path().split('/', QString::SkipEmptyParts);
if(pathTokens.count() == 1 && pathTokens.first() == QLatin1String("latest")) {
KIO::UDSEntry uds = createFolderUDSEntry(QLatin1String("latest"), i18n("Next Episodes To Watch"));
uds.insert(KIO::UDSEntry::UDS_ICON_NAME, QLatin1String("favorites"));
statEntry(uds);
finished();
}
else if(pathTokens.count() == 1) {
// stat series folder
Soprano::QueryResultIterator it
= Nepomuk2::ResourceManager::instance()->mainModel()->executeQuery(QString::fromLatin1("select distinct * where { "
"?r a nmm:TVSeries ; "
"nie:title %1 ; "
"nao:created ?cd ; "
"nao:lastModified ?md ; "
"nie:description ?d . } LIMIT 1")
.arg(Soprano::Node::literalToN3(pathTokens[0])),
Soprano::Query::QueryLanguageSparql);
if(it.next()) {
statEntry(createSeriesUDSEntry(it["r"].uri(),
pathTokens[0],
pathTokens[0],
it["d"].toString(),
it["cd"].literal().toDateTime(),
it["md"].literal().toDateTime()));
finished();
}
else {
error( ERR_DOES_NOT_EXIST, url.prettyUrl() );
}
}
else if(pathTokens.count() == 2) {
// stat season folder
statEntry(createFolderUDSEntry(pathTokens[0], pathTokens[1]));
finished();
}
else {
// FIXME
error( ERR_UNSUPPORTED_ACTION, url.prettyUrl() );
}
}