当前位置: 首页>>代码示例>>C++>>正文


C++ KUrl::isEmpty方法代码示例

本文整理汇总了C++中KUrl::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::isEmpty方法的具体用法?C++ KUrl::isEmpty怎么用?C++ KUrl::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KUrl的用法示例。


在下文中一共展示了KUrl::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: openScriptEditor

bool RKWorkplace::openScriptEditor (const KUrl &url, const QString& encoding, bool use_r_highlighting, bool read_only, const QString &force_caption, bool delete_on_close) {
	RK_TRACE (APP);

// is this url already opened?
	if (!url.isEmpty ()) {
	  	RKWorkplaceObjectList script_windows = getObjectList (RKMDIWindow::CommandEditorWindow, RKMDIWindow::AnyWindowState);
		for (RKWorkplaceObjectList::const_iterator it = script_windows.constBegin (); it != script_windows.constEnd (); ++it) {
			  KUrl ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
			  if (url == ourl) {
				  (*it)->activate ();
				  return true;
			  }
		}
	}

	RKCommandEditorWindow *editor = new RKCommandEditorWindow (view (), use_r_highlighting);

	if (!url.isEmpty ()) {
		if (!editor->openURL (url, encoding, use_r_highlighting, read_only, delete_on_close)) {
			delete editor;
			KMessageBox::messageBox (view (), KMessageBox::Error, i18n ("Unable to open \"%1\"", url.prettyUrl ()), i18n ("Could not open command file"));
			return false;
		}
	}

	if (!force_caption.isEmpty ()) editor->setCaption (force_caption);
	addWindow (editor);
	return true;
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:29,代码来源:rkworkplace.cpp

示例2: sltTempPostPublished

void StyleGetter::sltTempPostPublished( int blogId, BilboPost* post )
{
    kDebug();

    KUrl postUrl;
//     postUrl = post->permaLink();
    postUrl = post->link();
    if ( postUrl.isEmpty() ) {
        kDebug() << "link was empty";
//         postUrl = post->link();
        postUrl = post->permaLink();
        if ( postUrl.isEmpty() ) {
            kDebug() << "permaLink was empty";
            postUrl = KUrl( DBMan::self()->blog(blogId).blogUrl() );
        }
    }

    Q_EMIT sigGetStyleProgress( 30 );

    mTempPost = post;
    KIO::StoredTransferJob *job = KIO::storedGet( postUrl, KIO::NoReload, KIO::HideProgressInfo );
    connect( job, SIGNAL( result( KJob* ) ),
            this, SLOT( sltHtmlCopied( KJob* ) ) );

}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:25,代码来源:stylegetter.cpp

示例3: audioPlayFile

void KWQQuizView::audioPlayFile(const KUrl &soundUrl, bool overwrite)
{
    static KUrl lastUrl;

    KUrl *url = const_cast<KUrl *>(&soundUrl);
    if (overwrite)
       lastUrl = *url;

    if (url->isEmpty()) {
        if (lastUrl.isEmpty()) {
            m_actionCollection->action("quiz_audio_play")->setEnabled(false);
            return;
        }
        url = &lastUrl;
    }
    lastUrl = *url;
    m_actionCollection->action("quiz_audio_play")->setEnabled(true);

    kDebug() << "Attempting to play sound: " << *url;

    if (!m_player) {
        m_player = new Phonon::MediaObject(this);
        Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
        createPath(m_player, audioOutput);
    } else {
        m_player->stop();
    }
    m_player->setCurrentSource(*url);
    m_player->play();
}
开发者ID:phedlund,项目名称:kwordquiz,代码行数:30,代码来源:kwqquizview.cpp

示例4: slotFileOpen

void MainWindow::slotFileOpen()
{
    KUrl file = KFileDialog::getOpenUrl( KUrl("kfiledialog:///<keyword>"), "*", this );

    if ( !file.isEmpty() )
        load( file );
}
开发者ID:appillai,项目名称:ktechlab,代码行数:7,代码来源:mainwindow.cpp

示例5: moveToAnotherFolder

void BackupDialog::moveToAnotherFolder()
{
    KUrl selectedURL = KDirSelectDialog::selectDirectory(
                           /*startDir=*/Global::savesFolder(), /*localOnly=*/true, /*parent=*/0,
                           /*caption=*/i18n("Choose a Folder Where to Move Baskets"));

    if (!selectedURL.isEmpty()) {
        QString folder = selectedURL.path();
        QDir dir(folder);
        // The folder should not exists, or be empty (because KDirSelectDialog will likely create it anyway):
        if (dir.exists()) {
            // Get the content of the folder:
            QStringList content = dir.entryList();
            if (content.count() > 2) { // "." and ".."
                int result = KMessageBox::questionYesNo(
                                 0,
                                 "<qt>" + i18n("The folder <b>%1</b> is not empty. Do you want to override it?", folder),
                                 i18n("Override Folder?"),
                                 KGuiItem(i18n("&Override"), "document-save")
                             );
                if (result == KMessageBox::No)
                    return;
            }
            Tools::deleteRecursively(folder);
        }
        FormatImporter copier;
        copier.moveFolder(Global::savesFolder(), folder);
        Backup::setFolderAndRestart(folder, i18n("Your baskets have been successfully moved to <b>%1</b>. %2 is going to be restarted to take this change into account."));
    }
}
开发者ID:KrissN,项目名称:basket,代码行数:30,代码来源:backup.cpp

示例6: slotLoadSettings

void ResizeTool::slotLoadSettings()
{
    KUrl loadBlowupFile = KFileDialog::getOpenUrl(KGlobalSettings::documentPath(),
                          QString( "*" ), kapp->activeWindow(),
                          QString( i18n("Photograph Resizing Settings File to Load")) );

    if ( loadBlowupFile.isEmpty() )
    {
        return;
    }

    QFile file(loadBlowupFile.toLocalFile());

    if ( file.open(QIODevice::ReadOnly) )
    {
        if (!d->settingsWidget->loadSettings(file, QString("# Photograph Resizing Configuration File")))
        {
            KMessageBox::error(kapp->activeWindow(),
                               i18n("\"%1\" is not a Photograph Resizing settings text file.",
                                    loadBlowupFile.fileName()));
            file.close();
            return;
        }
    }
    else
    {
        KMessageBox::error(kapp->activeWindow(),
                           i18n("Cannot load settings from the Photograph Resizing text file."));
    }

    file.close();
}
开发者ID:UIKit0,项目名称:digikam,代码行数:32,代码来源:resizetool.cpp

示例7: saveAsSettings

void WBSettings::saveAsSettings()
{
    KUrl saveWhiteBalanceFile = KFileDialog::getSaveUrl(KGlobalSettings::documentPath(),
                                                        QString("*"), kapp->activeWindow(),
                                                        QString(i18n("White Color Balance Settings File to Save")));

    if (saveWhiteBalanceFile.isEmpty())
    {
        return;
    }

    QFile file(saveWhiteBalanceFile.toLocalFile());

    if (file.open(QIODevice::WriteOnly))
    {
        QTextStream stream(&file);
        stream << "# White Color Balance Configuration File V2\n";
        stream << d->temperatureInput->value() << "\n";
        stream << d->darkInput->value() << "\n";
        stream << d->blackInput->value() << "\n";
        stream << d->mainExposureInput->value() << "\n";
        stream << d->fineExposureInput->value() << "\n";
        stream << d->gammaInput->value() << "\n";
        stream << d->saturationInput->value() << "\n";
        stream << d->greenInput->value() << "\n";
    }
    else
    {
        KMessageBox::error(kapp->activeWindow(),
                           i18n("Cannot save settings to the White Color Balance text file."));
    }

    file.close();
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:34,代码来源:wbsettings.cpp

示例8: image

KoShape *KPrPlaceholderPictureStrategy::createShape(KoDocumentResourceManager *rm)
{
    KoShape * shape = 0;

    KUrl url = KFileDialog::getOpenUrl();
    if ( !url.isEmpty() ) {
        shape = KPrPlaceholderStrategy::createShape(rm);

        KoImageCollection *collection = rm->imageCollection();
        Q_ASSERT(collection);

        QString tmpFile;
        if (KIO::NetAccess::download(url, tmpFile, 0)) {
            QImage image(tmpFile);
            if (!image.isNull()) {
                //setSuffix(url.prettyUrl());
                KoImageData *data = collection->createImageData(image);
                if (data->isValid()) {
                    shape->setUserData( data );
                    // TODO the pic should be fit into the space provided
                    shape->setSize( data->imageSize() );
                }
            }
        } else {
            kWarning() << "open image " << url.prettyUrl() << "failed";
        }
    }
    return shape;
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:29,代码来源:KPrPlaceholderPictureStrategy.cpp

示例9: slotSaveClicked

void DOMTreeView::slotSaveClicked()
{
  //kDebug(90180) << "void KfingerCSSWidget::slotSaveAs()";
  KUrl url = KFileDialog::getSaveFileName( part->url().url(), "*.html",
					   this, i18n("Save DOM Tree as HTML") );
  if (!(url.isEmpty()) && url.isValid()) {
    QFile file(url.path());

    if (file.exists()) {
      const QString title = i18nc( "@title:window", "File Exists" );
      const QString text = i18n( "Do you really want to overwrite: \n%1?" , url.url());
      if (KMessageBox::Continue != KMessageBox::warningContinueCancel(this, text, title, i18n("Overwrite") ) ) {
	return;
      }
    }

    if (file.open(QIODevice::WriteOnly) ) {
      kDebug(90180) << "Opened File: " << url.url();
      m_textStream = new QTextStream(&file); //(stdOut)
      saveTreeAsHTML(part->document());
      file.close();
      kDebug(90180) << "File closed ";
      delete m_textStream;
    } else {
      const QString title = i18nc( "@title:window", "Unable to Open File" );
      const QString text = i18n( "Unable to open \n %1 \n for writing" , url.path());
      KMessageBox::sorry( this, text, title );
    }
  } else {
    const QString title = i18nc( "@title:window", "Invalid URL" );
    const QString text = i18n( "This URL \n %1 \n is not valid." , url.url());
    KMessageBox::sorry( this, text, title );
  }
}
开发者ID:blue-shell,项目名称:folderview,代码行数:34,代码来源:domtreeview.cpp

示例10: setImageInfo

void MediaPlayerView::setImageInfo(const ImageInfo& info, const ImageInfo& previous, const ImageInfo& next)
{
    d->prevAction->setEnabled(!previous.isNull());
    d->nextAction->setEnabled(!next.isNull());

    KUrl url = info.fileUrl();

    if (info.isNull() || url.isEmpty())
    {
        d->currentInfo = info;
        d->player->stop();
        return;
    }

    if (d->currentInfo == info &&
        (d->player->isPlaying() || d->player->isPaused()))
    {
        return;
    }

    d->currentInfo = info;

    d->player->play(url);
    setPreviewMode(MediaPlayerViewPriv::PlayerView);
}
开发者ID:UIKit0,项目名称:digikam,代码行数:25,代码来源:mediaplayerview.cpp

示例11: fileOpen

void KPlistEditor::fileOpen()
{
    // this slot is called whenever the File->Open menu is selected,
    // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
    // button is clicked
    KUrl url =
        KFileDialog::getOpenUrl( KUrl(), QString(), this );

    if (url.isEmpty() == false)
    {
        // About this function, the style guide (
        // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
        // says that it should open a new window if the document is _not_
        // in its initial state.  This is what we do here..
        if ( m_part->url().isEmpty() && ! m_part->isModified() )
        {
            // we open the file in this window...
            load( url );
        }
        else
        {
            // we open the file in a new window...
            KPlistEditor* newWin = new KPlistEditor;
            newWin->load( url );
            newWin->show();
        }
    }
}
开发者ID:thothonegan,项目名称:KPlistEditor,代码行数:28,代码来源:kplisteditor.cpp

示例12: startSearching

void DolphinViewContainer::startSearching(const QString &text)
{
    Q_UNUSED(text);
    const KUrl url = m_searchBox->urlForSearching();
    if (url.isValid() && !url.isEmpty()) {
        m_urlNavigator->setLocationUrl(url);
    }
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:8,代码来源:dolphinviewcontainer.cpp

示例13: addFavorite

void FavoritePlacesModel::addFavorite(const QString &favoriteId)
{
    KUrl favoriteUrl = FavoriteUtils::urlFromFavoriteId(favoriteId);
    if (favoriteUrl.isEmpty()) {
        return;
    }
    addPlace(favoriteUrl.fileName(), favoriteUrl);
}
开发者ID:KDE,项目名称:homerun,代码行数:8,代码来源:favoriteplacesmodel.cpp

示例14: selectHomeUrl

void StartupSettingsPage::selectHomeUrl()
{
    const QString homeUrl = m_homeUrl->text();
    KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this);
    if (!url.isEmpty()) {
        m_homeUrl->setText(url.prettyUrl());
        slotSettingsChanged();
    }
}
开发者ID:fluxer,项目名称:kde-baseapps,代码行数:9,代码来源:startupsettingspage.cpp

示例15: imageImport

void Import::imageImport()
{
    KUrl url = KFileDialog::getOpenUrl( KUrl(), QString::fromLatin1( "*.kim|" ) + i18nc(".kim files","KPhotoAlbum Export Files" ) );
    if ( url.isEmpty() )
        return;

    imageImport( url );
    // This instance will delete itself when done.
}
开发者ID:astifter,项目名称:kphotoalbum-astifter-branch,代码行数:9,代码来源:Import.cpp


注:本文中的KUrl::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。