コード例 #1
0
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;
}
コード例 #2
0
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* ) ) );

}
コード例 #3
0
ファイル: kwqquizview.cpp プロジェクト: phedlund/kwordquiz
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();
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: appillai/ktechlab
void MainWindow::slotFileOpen()
{
    KUrl file = KFileDialog::getOpenUrl( KUrl("kfiledialog:///<keyword>"), "*", this );

    if ( !file.isEmpty() )
        load( file );
}
コード例 #5
0
ファイル: backup.cpp プロジェクト: KrissN/basket
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."));
    }
}
コード例 #6
0
ファイル: resizetool.cpp プロジェクト: UIKit0/digikam
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();
}
コード例 #7
0
ファイル: wbsettings.cpp プロジェクト: rickysarraf/digikam
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();
}
コード例 #8
0
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;
}
コード例 #9
0
ファイル: domtreeview.cpp プロジェクト: blue-shell/folderview
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 );
  }
}
コード例 #10
0
ファイル: mediaplayerview.cpp プロジェクト: UIKit0/digikam
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);
}
コード例 #11
0
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();
        }
    }
}
コード例 #12
0
void DolphinViewContainer::startSearching(const QString &text)
{
    Q_UNUSED(text);
    const KUrl url = m_searchBox->urlForSearching();
    if (url.isValid() && !url.isEmpty()) {
        m_urlNavigator->setLocationUrl(url);
    }
}
コード例 #13
0
ファイル: favoriteplacesmodel.cpp プロジェクト: KDE/homerun
void FavoritePlacesModel::addFavorite(const QString &favoriteId)
{
    KUrl favoriteUrl = FavoriteUtils::urlFromFavoriteId(favoriteId);
    if (favoriteUrl.isEmpty()) {
        return;
    }
    addPlace(favoriteUrl.fileName(), favoriteUrl);
}
コード例 #14
0
void StartupSettingsPage::selectHomeUrl()
{
    const QString homeUrl = m_homeUrl->text();
    KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this);
    if (!url.isEmpty()) {
        m_homeUrl->setText(url.prettyUrl());
        slotSettingsChanged();
    }
}
コード例 #15
0
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.
}
コード例 #16
0
void
PixmapCollectionEditor::newItemByPath()
{
    KUrl url = KFileDialog::getImageOpenURL("kfiledialog:///kexi", parentWidget());
    if (url.isEmpty())
        return;
    QString name = m_collection->addPixmapPath(url);
    createIconViewItem(name);
}
コード例 #17
0
ファイル: EditProfileDialog.cpp プロジェクト: Maijin/konsole
void EditProfileDialog::selectInitialDir()
{
    const KUrl url = KFileDialog::getExistingDirectoryUrl(_ui->initialDirEdit->text(),
                                                          this,
                                                          i18n("Select Initial Directory"));

    if ( !url.isEmpty() )
        _ui->initialDirEdit->setText(url.path());
}
コード例 #18
0
ファイル: projectmodel.cpp プロジェクト: ShermanHuang/kdesdk
void ProjectModel::setUrl(const KUrl &poUrl, const KUrl &potUrl)
{
    //kDebug() << "ProjectModel::openUrl("<< poUrl.pathOrUrl() << +", " << potUrl.pathOrUrl() << ")";

    //cleanup old data

    m_dirsWaitingForMetadata.clear();

    if (m_activeJob != NULL)
        m_activeJob->setStatus(-1);
    m_activeJob = NULL;

    if (m_rootNode.rows.count())
    {
        beginRemoveRows(QModelIndex(), 0, m_rootNode.rows.count());

        for (int pos = 0; pos < m_rootNode.rows.count(); pos ++)
            deleteSubtree(m_rootNode.rows.at(pos));
        m_rootNode.rows.clear();
        m_rootNode.poCount = 0;
        m_rootNode.translated = -1;
        m_rootNode.translated_reviewer = -1;
        m_rootNode.translated_approver = -1;
        m_rootNode.untranslated = -1;
        m_rootNode.fuzzy = -1;
        m_rootNode.fuzzy_reviewer = -1;
        m_rootNode.fuzzy_approver = -1;

        endRemoveRows();
    }

    //add trailing slashes to base URLs, needed for potToPo and poToPot
    m_poUrl = poUrl;
    m_potUrl = potUrl;
    m_poUrl.adjustPath(KUrl::AddTrailingSlash);
    m_potUrl.adjustPath(KUrl::AddTrailingSlash);

    emit loading();

    if (!poUrl.isEmpty())
        m_poModel.dirLister()->openUrl(m_poUrl, KDirLister::Reload);
    if (!potUrl.isEmpty())
        m_potModel.dirLister()->openUrl(m_potUrl, KDirLister::Reload);
}
コード例 #19
0
void CppHelperPluginConfigPage::addDirTo(const KUrl& dir_uri, KListWidget* const list)
{
    if (dir_uri.isValid() && !dir_uri.isEmpty())
    {
        // get URI as local file/path
        auto dir_str = QDir::cleanPath(dir_uri.toLocalFile());
        if (!contains(dir_str, list))                       // append only if given path not in a list already
            new QListWidgetItem{dir_str, list};
    }
}
コード例 #20
0
ファイル: backup.cpp プロジェクト: KrissN/basket
void BackupDialog::useAnotherExistingFolder()
{
    KUrl selectedURL = KDirSelectDialog::selectDirectory(
                           /*startDir=*/Global::savesFolder(), /*localOnly=*/true, /*parent=*/0,
                           /*caption=*/i18n("Choose an Existing Folder to Store Baskets"));

    if (!selectedURL.isEmpty()) {
        Backup::setFolderAndRestart(selectedURL.path(), i18n("Your basket save folder has been successfuly changed to <b>%1</b>. %2 is going to be restarted to take this change into account."));
    }
}
コード例 #21
0
ファイル: notedrag.cpp プロジェクト: tytycoon/basket
void NoteDrag::serializeLinks(NoteSelection *noteList, K3MultipleDrag *multipleDrag, bool cutting)
{
	KUrl::List  urls;
	QStringList titles;
	KUrl    url;
	QString title;
	for (NoteSelection *node = noteList->firstStacked(); node; node = node->nextStacked()) {
		node->note->content()->toLink(&url, &title, node->fullPath);
		if (!url.isEmpty()) {
			urls.append(url);
			titles.append(title);
		}
	}
	if (!urls.isEmpty()) {
		// First, the standard text/uri-list MIME format:
#if KDE_IS_VERSION( 3, 3, 90 )
		K3URLDrag *urlsDrag = new K3URLDrag(urls);
		// ONLY export as text/uri-list, and not as text/plain* as we wil do that better ourself
		urlsDrag->setExportAsText(false);
		multipleDrag->addDragObject(urlsDrag);
#else
		K3URLDrag2 *urlsDrag = new K3URLDrag2(urls);
		QByteArray byteArray = urlsDrag->encodedData2("text/uri-list");
		Q3StoredDrag *uriListDrag = new Q3StoredDrag("text/uri-list");
		uriListDrag->setEncodedData(byteArray);
		multipleDrag->addDragObject(uriListDrag);
		delete urlsDrag;
#endif
		// Then, also provide it in the Mozilla proprietary format (that also allow to add titles to URLs):
		// A version for Mozilla applications (convert to "theUrl\ntheTitle", into UTF-16):
		// FIXME: Does Mozilla support the drag of several URLs at once?
		// FIXME: If no, only provide that if theire is only ONE URL.
		QString xMozUrl;
		for (int i = 0; i < urls.count(); ++i)
			xMozUrl += (xMozUrl.isEmpty() ? "" : "\n") + urls[i].prettyUrl() + "\n" + titles[i];
/*		Code for only one: ===============
		xMozUrl = note->title() + "\n" + note->url().prettyUrl();*/
		QByteArray baMozUrl;
		QTextStream stream(baMozUrl, QIODevice::WriteOnly);
		stream.setEncoding(QTextStream::RawUnicode); // It's UTF16 (aka UCS2), but with the first two order bytes
		stream << xMozUrl;
		Q3StoredDrag *xMozUrlDrag = new Q3StoredDrag("text/x-moz-url");
		xMozUrlDrag->setEncodedData(baMozUrl);
		multipleDrag->addDragObject(xMozUrlDrag);

		if (cutting) {
			QByteArray  arrayCut(2);
			Q3StoredDrag *storedDragCut = new Q3StoredDrag("application/x-kde-cutselection");
			arrayCut[0] = '1';
			arrayCut[1] = 0;
			storedDragCut->setEncodedData(arrayCut);
			multipleDrag->addDragObject(storedDragCut);
		}
	}
}
コード例 #22
0
void VectorShapeConfigWidget::save()
{
    if (!m_shape)
        return;
    m_fileWidget->accept();
    KUrl url = m_fileWidget->selectedUrl();
    if (!url.isEmpty()) {
        KIO::StoredTransferJob *job = KIO::storedGet(url, KIO::NoReload, 0);
        LoadWaiter *waiter = new LoadWaiter(m_shape);
        connect(job, SIGNAL(result(KJob*)), waiter, SLOT(setImageData(KJob*)));
    }
}
コード例 #23
0
void ImagePropertiesGPSTab::setCurrentURL(const KUrl& url)
{
    if (url.isEmpty())
    {
        clearGPSInfo();
        return;
    }

    const DMetadata meta(url.toLocalFile());

    setMetadata(meta, url);
}
コード例 #24
0
ファイル: TestCueFileSupport.cpp プロジェクト: ErrAza/amarok
void TestCueFileSupport::testLocateCueFile()
{
  //Check that we find the right .cue file and that it passes the validator
  KUrl cueTestUrl = dataPath( "data/cue/testsheet01-iso8859-1.cue" );
  KUrl cueResultUrl = CueFileSupport::locateCueSheet( cueTestUrl );

  QVERIFY( !cueResultUrl.url().isEmpty() );
  QCOMPARE( cueResultUrl.url(), cueTestUrl.url() );

  //Check that a nonexisting cue file returns an empty url
  KUrl testUrl = dataPath( "data/cue/test_silence.ogg" );
  cueResultUrl = CueFileSupport::locateCueSheet( testUrl );

  QVERIFY( cueResultUrl.isEmpty() );

  //Check that an existing but invalid cue file returns an empty url
  testUrl = dataPath( "data/cue/invalid.cue" );
  cueResultUrl = CueFileSupport::locateCueSheet( testUrl );

  QVERIFY( cueResultUrl.isEmpty() );
}
コード例 #25
0
ファイル: resourcebrowser.cpp プロジェクト: phalgun/RepontiK
void ResourceBrowser::slotOpenLinkedResource(QModelIndex selectedResource)
{
    m_linkedResourceView->selectionModel()->setCurrentIndex(selectedResource,QItemSelectionModel::NoUpdate);
    Nepomuk::Resource currentResource = (m_linkedResourceViewModel->resourceForIndex(
                                             m_linkedResourceView->selectionModel()->currentIndex()));
    KUrl url = currentResource.property(Nepomuk::Vocabulary::NIE::url()).toString();
    qDebug()<<url<<"usagecount="<<currentResource.usageCount();
    if(!url.isEmpty()) {
        new KRun(url,this);
        currentResource.increaseUsageCount();
    }
}
コード例 #26
0
KritaShape::KritaShape(const KUrl& url, const QString & profileName)
        : m_d(new Private())
{
    m_d->url = url;
    m_d->doc = 0;
    if (!url.isEmpty()) {
        importImage(url);
    }
    m_d->displayProfile = KoColorSpaceRegistry::instance()->profileByName(profileName);
    setKeepAspectRatio(true);
    moveToThread(QCoreApplication::instance()->thread()); // it's a QObject; lets make sure it always has a proper thread.
}
コード例 #27
0
KAResourceRemote::KAResourceRemote(Type type, const KUrl& downloadUrl, const KUrl& uploadUrl)
	: AlarmResource(type),
	  mDownloadUrl(downloadUrl),
	  mUploadUrl(uploadUrl.isEmpty() ? mDownloadUrl : uploadUrl),
	  mDownloadJob(0),
	  mUploadJob(0),
	  mShowProgress(false),
	  mUseCacheFile(false),
	  mRemoteReadOnly(false)
{
	init();
}
コード例 #28
0
ファイル: resource.cpp プロジェクト: KDE/nepomuk-core
// TODO: cache this one in ResourceData
QString Nepomuk2::Resource::genericLabel() const
{
    QString label = this->label();
    if(!label.isEmpty())
        return label;

    label = property( Soprano::Vocabulary::RDFS::label() ).toString();
    if(!label.isEmpty())
        return label;

    label = property( Nepomuk2::Vocabulary::NIE::title() ).toString();
    if(!label.isEmpty())
        return label;

    label = property( Nepomuk2::Vocabulary::NCO::fullname() ).toString();
    if(!label.isEmpty())
        return label;

    label = property( Soprano::Vocabulary::NAO::identifier() ).toString();
    if(!label.isEmpty())
        return label;

    //label = m_data->pimoThing().label();
    //if(!label.isEmpty())
    //    return label;

    label = property( Nepomuk2::Vocabulary::NFO::fileName() ).toString();
    if(!label.isEmpty())
        return label;

    const KUrl nieUrl = property( Nepomuk2::Vocabulary::NIE::url() ).toUrl();
    if(!nieUrl.isEmpty()) {
        if(nieUrl.isLocalFile())
            return nieUrl.fileName();
        else
            return nieUrl.prettyUrl();
    }

    QList<Resource> go = property( Vocabulary::PIMO::groundingOccurrence() ).toResourceList();
    if( !go.isEmpty() ) {
        label = go.first().genericLabel();
        if( label != KUrl(go.first().uri()).pathOrUrl() ) {
            return label;
        }
    }

    QString hashValue = property( Vocabulary::NFO::hashValue() ).toString();
    if( !hashValue.isEmpty() )
        return hashValue;

    // ugly fallback
    return KUrl(uri()).pathOrUrl();
}
コード例 #29
0
ファイル: quantaprojectpart.cpp プロジェクト: KDE/quanta
void QuantaProjectPart::slotInsertFolder()
{
  KUrl url = KUrl();
  url = KFileDialog::getExistingUrl(m_projectBase, Koncrete::Core::mainWindow(), i18n("Insert Folder in Project"));

  if (!url.isEmpty())
  {
    if (!m_projectBase.isParentOf(url))
    {
      KUrlRequesterDialog urlRequesterDlg(m_projectBase.pathOrUrl(), Koncrete::Core::mainWindow());
      urlRequesterDlg.setWindowTitle(i18n("%1: Copy to Project", url.pathOrUrl()));
      urlRequesterDlg.urlRequester()->setMode(KFile::Directory | KFile::ExistingOnly);
      urlRequesterDlg.exec();
      KUrl destination = urlRequesterDlg.selectedUrl();
      if (!destination.isEmpty())
      {
        destination.adjustPath(KUrl::AddTrailingSlash);
        QuantaNetAccess::dircopy(url, destination, this, false);
      }
    } else
    {
      KUrl::List urls = ExtFileInfo::allFilesRelative(url, "*");
      QStringList filenames;
      KUrl u = KUrl::relativeUrl(m_projectBase, url);
      QStringList sections = u.path(KUrl::AddTrailingSlash).split('/', QString::SkipEmptyParts);
      QString section;
      for (int i = 0 ; i < sections.count(); i++)
      {
        section += sections[i] + '/';
        filenames += section;
      }
      KUrl::List::ConstIterator end = urls.constEnd();
      for (KUrl::List::ConstIterator it = urls.begin(); it != end; ++it)
      {
        filenames += url.fileName() + '/' + (*it).path();
      }
      addFiles(filenames);
    }
  }
}
コード例 #30
0
ResourceLocal::ResourceLocal( const KConfigGroup &group )
  : ResourceNotes( group ), mCalendar( QString::fromLatin1( "UTC" ) )
{
  kDebug( 5500 ) << "ResourceLocal::ResourceLocal()";
  setType( "file" );
  mURL = KUrl::fromPath( KGlobal::dirs()->saveLocation( "data", "knotes/" ) +
                         "notes.ics" );

  KUrl u = group.readPathEntry( "NotesURL", QString() );
  if ( !u.isEmpty() ) {
    mURL = u;
  }
}