Esempio n. 1
0
void SoundtrackDialog::addItems(const KUrl::List& fileList)
{
    if (fileList.isEmpty())
        return;

    KUrl::List Files = fileList;

    for (KUrl::List::ConstIterator it = Files.constBegin(); it != Files.constEnd(); ++it)
    {
        KUrl currentFile             = *it;
        KUrl path                    = KUrl(currentFile.path().section('/', 0, -1));
        m_sharedData->soundtrackPath = path;
        SoundItem *item              = new SoundItem(m_SoundFilesListBox, path);
        item->setName(currentFile.path().section('/', -1));
        m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item);

        m_soundItems->insert(path, item);

        connect(m_soundItems->value(path), SIGNAL(signalTotalTimeReady(const KUrl&, const QTime&)),
                this, SLOT(slotAddNewTime(const KUrl&, const QTime&)));

        m_urlList.append(path);
    }

    m_SoundFilesListBox->setCurrentItem(m_SoundFilesListBox->item(m_SoundFilesListBox->count() - 1)) ;

    slotSoundFilesSelected(m_SoundFilesListBox->currentRow());
    m_SoundFilesListBox->scrollToItem(m_SoundFilesListBox->currentItem());
    m_previewButton->setEnabled(true);
}
void PlaylistModel::sort(int column, Qt::SortOrder order)
{
    if (m_tracks.count() < 2)
    {
        return;
    }

    QMultiMap<QString, KUrl> keyMap;
    QMultiMap<qint64, KUrl> durationMap;
    KUrl::List tracks;
    const KUrl url = m_tracks.value(m_currentTrack);

    if (column == DurationColumn)
    {
        for (int i = 0; i < m_tracks.count(); ++i)
        {
            durationMap.insert(MetaDataManager::duration(m_tracks.at(i)), m_tracks.at(i));
        }

        tracks = durationMap.values();
    }
    else if (column > FileNameColumn && column < DurationColumn)
    {
        const MetaDataKey key = translateColumn(column);

        for (int i = 0; i < m_tracks.count(); ++i)
        {
            keyMap.insert(MetaDataManager::metaData(m_tracks.at(i), key), m_tracks.at(i));
        }

        tracks = keyMap.values();
    }
    else
    {
        for (int i = 0; i < m_tracks.count(); ++i)
        {
            keyMap.insert(m_tracks.at(i).pathOrUrl(), m_tracks.at(i));
        }

        tracks = keyMap.values();
    }

    if (order == Qt::AscendingOrder)
    {
        KUrl::List items;

        for (int i = (tracks.count() - 1); i >= 0; --i)
        {
            items.append(tracks.at(i));
        }

        tracks = items;
    }

    m_tracks = tracks;

    setCurrentTrack(findTrack(url));

    emit tracksChanged();
}
Esempio n. 3
0
void KNewFileMenuPrivate::executeOtherDesktopFile(const KNewFileMenuSingleton::Entry& entry)
{
    if (!checkSourceExists(entry.templatePath)) {
        return;
    }

    KUrl::List::const_iterator it = m_popupFiles.constBegin();
    for (; it != m_popupFiles.constEnd(); ++it)
    {
        QString text = entry.text;
        text.remove("..."); // the ... is fine for the menu item but not for the default filename
        text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
        // KDE5 TODO: remove the "..." from link*.desktop files and use i18n("%1...") when making
        // the action.

        KUrl defaultFile(*it);
        defaultFile.addPath(KIO::encodeFileName(text));
        if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
            text = KIO::RenameDialog::suggestName(*it, text);

        const KUrl templateUrl(entry.templatePath);
	
	KDialog* dlg = new KPropertiesDialog(templateUrl, *it, text, m_parentWidget);
	dlg->setModal(q->isModal());
	dlg->setAttribute(Qt::WA_DeleteOnClose);
        QObject::connect(dlg, SIGNAL(applied()), q, SLOT(_k_slotOtherDesktopFile()));
	dlg->show();
    }
    // We don't set m_src here -> there will be no copy, we are done.
}
Esempio n. 4
0
void SaverConfig::add()
{
    KURL::List files = KFileDialog::getOpenURLs( TQString(), TQString(),
                                                 this, i18n("Select Media Files") );
    for( unsigned int n=0; n<files.count(); n++ )
        m_files->insertItem( files[n].prettyURL(), -1 );
}
void AlbumModificationHelper::slotAlbumDelete(PAlbum* album)
{
    if (!album || album->isRoot() || album->isAlbumRoot())
    {
        return;
    }

    // find subalbums
    KUrl::List childrenList;
    addAlbumChildrenToList(childrenList, album);

    DeleteDialog dialog(d->dialogParent);

    // All subalbums will be presented in the list as well
    if (!dialog.confirmDeleteList(childrenList,
                                  childrenList.size() == 1 ?
                                  DeleteDialogMode::Albums : DeleteDialogMode::Subalbums,
                                  DeleteDialogMode::UserPreference))
    {
        return;
    }

    bool useTrash = !dialog.shouldDelete();

    // Currently trash kioslave can handle only full paths.
    // pass full folder path to the trashing job
    DIO::del(album, useTrash);
}
Esempio n. 6
0
KURL::List K3b::convertToLocalUrls( const KURL::List& urls )
{
  KURL::List r;
  for( KURL::List::const_iterator it = urls.constBegin(); it != urls.constEnd(); ++it )
    r.append( convertToLocalUrl( *it ) );
  return r;
}
Esempio n. 7
0
void ImageButton::dropEvent( QDropEvent *event )
{
    if ( mReadOnly )
        return;

    const QMimeData *md = event->mimeData();
    if ( md->hasImage() ) {
        QImage image = qvariant_cast<QImage>(md->imageData());
        mPicture.setData( image );
        updateGui();
        emit changed();
    }

    KUrl::List urls = KUrl::List::fromMimeData( md );
    if ( urls.isEmpty() ) { // oops, no data
        event->setAccepted( false );
    } else {
        if ( mImageLoader ) {
            bool ok = false;
            KABC::Picture pic = mImageLoader->loadPicture( urls.first(), &ok );
            if ( ok ) {
                mPicture = pic;
                updateGui();
                emit changed();
            }
        }
    }
}
Esempio n. 8
0
bool NetAccess::move( const KUrl& src, const KUrl& target, QWidget* window )
{
  KUrl::List srcList;
  srcList.append( src );
  NetAccess kioNet;
  return kioNet.dircopyInternal( srcList, target, window, true /*move*/ );
}
Esempio n. 9
0
SvnHelper::SvnHelper():KApplication() {
	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
#ifdef Q_WS_X11
	m_id=KWindowSystem::activeWindow();
	KWindowSystem::activateWindow(m_id);
#else
	m_id = 0;
#endif

	KUrl::List list;
	for ( int i = 0 ; i < args->count() ; i++ )
		list << args->url(i);

	if (args->isSet("u")) {
		kDebug(7128) << "update " << list;
		const KUrl servURL("svn+http://this_is_a_fake_URL_and_this_is_normal/");
		//FIXME when 1.2 is out (move the loop inside kio_svn's ::update)
		for ( QList<KUrl>::const_iterator it = list.constBegin(); it != list.constEnd() ; ++it ) {
			QByteArray parms;
			QDataStream s( &parms, QIODevice::WriteOnly );
			int cmd = 2;
			int rev = -1;
			kDebug(7128) << "updating : " << (*it).prettyUrl();
			s << cmd << *it << rev << QString( "HEAD" );
			KIO::SimpleJob * job = KIO::special(servURL, parms);
			connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
			KIO::NetAccess::synchronousRun( job, 0 );
		}
	} else if (args->isSet("c")) {
Esempio n. 10
0
void ImporterTest::testSuccessfulImport()
{
    KUrl destUrl = KUrl::fromPath(mTempDir->name() + "/foo");

    Importer importer(0);
    QSignalSpy maximumChangedSpy(&importer, SIGNAL(maximumChanged(int)));
    QSignalSpy errorSpy(&importer, SIGNAL(error(QString)));

    KUrl::List list = mDocumentList;

    QEventLoop loop;
    connect(&importer, SIGNAL(importFinished()), &loop, SLOT(quit()));
    importer.start(list, destUrl);
    loop.exec();

    QCOMPARE(maximumChangedSpy.count(), 1);
    QCOMPARE(maximumChangedSpy.takeFirst().at(0).toInt(), list.count() * 100);
    QCOMPARE(errorSpy.count(), 0);

    QCOMPARE(importer.importedUrlList().count(), list.count());
    QCOMPARE(importer.importedUrlList(), list);
    QCOMPARE(importer.skippedUrlList().count(), 0);
    QCOMPARE(importer.renamedCount(), 0);

    Q_FOREACH(const KUrl & src, list) {
        KUrl dst = destUrl;
        dst.addPath(src.fileName());
        QVERIFY(FileUtils::contentsAreIdentical(src, dst));
    }
Esempio n. 11
0
void KonqSidebarTree::contentsDropEvent( QDropEvent *ev )
{
    if (d->m_dropMode == SidebarTreeMode) {
        m_autoOpenTimer->stop();

        if ( !selectedItem() )
        {
    //        KonqOperations::doDrop( 0L, m_dirtreeDir.dir, ev, this );
            KURL::List urls;
            if ( KURLDrag::decode( ev, urls ) )
            {
               for(KURL::List::ConstIterator it = urls.begin();
                   it != urls.end(); ++it)
               {
                  addURL(0, *it);
               }
            }
        }
        else
        {
            KonqSidebarTreeItem *selection = static_cast<KonqSidebarTreeItem *>( selectedItem() );
            selection->drop( ev );
        }
    } else {
        KListView::contentsDropEvent(ev);
    }
}
Esempio n. 12
0
void PICComponent::slotUpdateFileList()
{
	QStringList preFileList = KTechlab::self()->recentFiles();
	
	QStringList fileList;
	 
	if ( ProjectInfo * info = ProjectManager::self()->currentProject() )
	{
		const KUrl::List urls = info->childOutputURLs( ProjectItem::AllTypes, ProjectItem::ProgramOutput );
		KUrl::List::const_iterator urlsEnd = urls.end();
		for ( KUrl::List::const_iterator it = urls.begin(); it != urlsEnd; ++it )
			fileList << (*it).path();
	}
	
	const QStringList::iterator end = preFileList.end();
	for ( QStringList::iterator it = preFileList.begin(); it != end; ++it )
	{
		QString file = KUrl(*it).path();
		if ( (file.endsWith(".flowcode") || file.endsWith(".asm") || file.endsWith(".cod") || file.endsWith(".basic") || file.endsWith(".microbe") ) && !fileList.contains(file) ) {
			fileList.append(file);
		}
	}
	
	QString fileName = dataString("program");
	
	property("program")->setAllowed(fileList);
	property("program")->setValue( fileName.isEmpty() ? _def_PICComponent_fileName : fileName );
}
Esempio n. 13
0
void GPSSyncDialog::setImages(const KUrl::List& images)
{
    for ( KUrl::List::ConstIterator it = images.begin(); it != images.end(); ++it )
    {
        KipiImageItem* const newItem = new KipiImageItem(iface(), *it);
        newItem->loadImageData(true, false);
        d->imageModel->addItem(newItem);
    }

    QList<QPersistentModelIndex> imagesToLoad;
    for (int i=0; i<d->imageModel->rowCount(); ++i)
    {
        imagesToLoad << d->imageModel->index(i, 0);
    }

    slotSetUIEnabled(false);
    slotProgressSetup(imagesToLoad.count(), i18n("Loading metadata - %p%"));

    // initiate the saving
    d->fileIOCountDone     = 0;
    d->fileIOCountTotal    = imagesToLoad.count();
    d->fileIOFutureWatcher = new QFutureWatcher<QPair<KUrl, QString> >(this);

    connect(d->fileIOFutureWatcher, SIGNAL(resultsReadyAt(int,int)),
            this, SLOT(slotFileMetadataLoaded(int,int)));

    d->fileIOFuture = QtConcurrent::mapped(imagesToLoad, LoadFileMetadataHelper(d->imageModel));
    d->fileIOFutureWatcher->setFuture(d->fileIOFuture);
}
Esempio n. 14
0
void SoundtrackDialog::slotPreviewButtonClicked()
{
    KUrl::List urlList;

    for (int i = 0 ; i < m_SoundFilesListBox->count() ; ++i)
    {
        SoundItem *pitem = static_cast<SoundItem*>( m_SoundFilesListBox->item(i) );
        QString path = pitem->url().toLocalFile();

        if (!QFile::exists(path))
        {
            KMessageBox::error(this,
                               i18n("Cannot access file %1. Please check the path is correct.", path));
            return;
        }

        urlList.append(path);  // Input sound files.
    }

    if ( urlList.isEmpty() )
    {
        KMessageBox::error(this,
                           i18n("Cannot create a preview of an empty file list."));
        return;
    }

    // Update SharedContainer from interface
    saveSettings();

    QPointer<SoundtrackPreview> preview = new SoundtrackPreview(this, urlList, m_sharedData);
    preview->exec();

    delete preview;
    return;
}
Esempio n. 15
0
void K3b::MovixDoc::addUrlsAt( const KUrl::List& urls, int pos )
{
    QList<K3b::MovixFileItem*> items;

    for( KUrl::List::ConstIterator it = urls.begin(); it != urls.end(); ++it ) {
        KUrl url = K3b::convertToLocalUrl( *it );

        QFileInfo f( url.toLocalFile() );
        if( !f.isFile() || !url.isLocalFile() )
            continue;

        QString newName = f.fileName();

        bool ok = true;
        while( ok && nameAlreadyInDir( newName, root() ) ) {
            newName = KInputDialog::getText( i18n("Enter New Filename"),
                                             i18n("A file with that name already exists. Please enter a new name:"),
                                             newName, &ok, view() );
        }

        if( ok ) {
            MovixFileItem* newItem = new MovixFileItem( f.absoluteFilePath(), *this, newName );
            root()->addDataItem( newItem );
            items.append( newItem );
        }
    }

    addMovixItems( items, pos );
}
Esempio n. 16
0
void MainWindow::slotScheduleImagesForLoading(const KUrl::List imagesToSchedule)
{
    if (imagesToSchedule.isEmpty())
        return;

    if (d->imageLoadingTotalCount == 0)
    {
        statusBar()->addWidget(d->progressBar);
        d->imageLoadingBunchTimer->start(100);
    }

    d->imageLoadingTotalCount+=imagesToSchedule.count();
    d->progressBar->setRange(0, d->imageLoadingTotalCount);
    d->progressBar->setValue(d->imageLoadingCurrentCount);
    QFutureWatcher<MyImageData>* const watcher = new QFutureWatcher<MyImageData>(this);

    connect(watcher, SIGNAL(resultsReadyAt(int,int)),
            this, SLOT(slotFutureResultsReadyAt(int,int)));

    QFuture<MyImageData> future = QtConcurrent::mapped(imagesToSchedule, LoadImageData);
    watcher->setFuture(future);

    d->imageLoadingRunningFutures << future;
    d->imageLoadingFutureWatchers << watcher;
}
Esempio n. 17
0
KURL *decodeImgDrop(QDropEvent *e, QWidget *wdg)
{
    KURL::List uris;

    if (KURLDrag::decode(e, uris) && (uris.count() > 0)) {
	KURL *url = new KURL(uris.first());

	KImageIO::registerFormats();
	if( KImageIO::canRead(KImageIO::type(url->fileName())) )
	    return url;

	QStringList qs = QStringList::split('\n', KImageIO::pattern());
	qs.remove(qs.begin());

	QString msg = i18n( "%1 "
			    "does not appear to be an image file.\n"
			    "Please use files with these extensions:\n"
			    "%2")
			    .arg(url->fileName())
			    .arg(qs.join("\n"));
	KMessageBox::sorry( wdg, msg);
	delete url;
    }
    return 0;
}
Esempio n. 18
0
void DrawZone::viewportDropEvent( QDropEvent* e) {
	KURL::List urlList;
	// A file from konqueror was dropped
	if (KURLDrag::decode(e,urlList)) {
		imageMapEditor->openFile(urlList.first());
	}
}
Esempio n. 19
0
bool DocumentationViewer::urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments & /* browserArgs */)
{
	KUrl cURL = completeURL(url);
	QString mime = KMimeType::findByUrl(cURL).data()->name();

	//load this URL in the embedded viewer if KHTML can handle it, or when mimetype detection failed
	KService::Ptr service = KService::serviceByDesktopName("khtml");
	if(( mime == KMimeType::defaultMimeType() ) || (service && service->hasServiceType(mime))) {
		KHTMLPart::urlSelected(url, button, state, _target, args);
		openUrl(cURL);
		addToHistory(cURL.url());
	}
	//KHTML can't handle it, look for an appropriate application
	else {
		KService::List offers = KMimeTypeTrader::self()->query(mime, "Type == 'Application'");
		if(offers.isEmpty()) {
			KMessageBox::error(view(), i18n("No KDE service found for the MIME type \"%1\".", mime));
			return false;
		}
		KUrl::List lst;
		lst.append(cURL);
		KRun::run(*(offers.first()), lst, view());
	}
	return true;
}
Esempio n. 20
0
TQDragObject * KfindWindow::dragObject()
{
  KURL::List uris;
  TQPtrList<TQListViewItem> selected = selectedItems();

  // create a list of URIs from selection
  for ( uint i = 0; i < selected.count(); i++ )
  {
    KfFileLVI *item = (KfFileLVI *) selected.at( i );
    if (item)
    {
      uris.append( item->fileitem.url() );
    }
  }

  if ( uris.count() <= 0 )
     return 0;

  TQUriDrag *ud = new KURLDrag( uris, (TQWidget *) this, "kfind uridrag" );

  const TQPixmap *pix = currentItem()->pixmap(0);
  if ( pix && !pix->isNull() )
    ud->setPixmap( *pix );

  return ud;
}
Esempio n. 21
0
void KateFileTree::slotOpenWithMenuAction(QAction* a)
{
  KUrl::List list;
  
  KTextEditor::Document *doc = model()->data(m_indexContextMenu, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
  if (!doc) return;

  
  list.append( doc->url() );

  const QString openWith = a->data().toString();
  if (openWith.isEmpty())
  {
    // display "open with" dialog
    KOpenWithDialog dlg(list);
    if (dlg.exec())
      KRun::run(*dlg.service(), list, this);
    return;
  }

  KService::Ptr app = KService::serviceByDesktopPath(openWith);
  if (app)
  {
    KRun::run(*app, list, this);
  }
  else
  {
    KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
  }
}
Esempio n. 22
0
KURL::List MediaDirNotify::toMediaURL(const KURL &url)
{
	kdDebug(1219) << "MediaDirNotify::toMediaURL(" << url << ")" << endl;

	KURL::List result;
	
	const TQPtrList<Medium> list = m_mediaList.list();

	TQPtrList<Medium>::const_iterator it = list.begin();
	TQPtrList<Medium>::const_iterator end = list.end();

	for (; it!=end; ++it)
	{
		const Medium *m = *it;
		KURL base = m->prettyBaseURL();

		if ( base.isParentOf(url) )
		{
			TQString path = KURL::relativePath(base.path(),
			                                  url.path());

			KURL new_url("media:/"+m->name()+"/"+path );
			new_url.cleanPath();
		
			result.append(new_url);
		}
	}

	kdDebug(1219) << result << endl;
	return result;
}
Esempio n. 23
0
    void GUI::openTorrent()
    {
        QString filter = kt::TorrentFileFilter(true);
        KUrl::List urls = KFileDialog::getOpenUrls(KUrl("kfiledialog:///openTorrent"), filter, this, i18n("Open Location"));

        if (urls.count() == 0)
            return;
        else if (urls.count() == 1)
        {
            KUrl url = urls.front();
            if (url.isValid())
                load(url);
        }
        else
        {
            // load multiple torrents silently
            foreach (const KUrl& url, urls)
            {
                if (url.isValid())
                {
                    if (Settings::openMultipleTorrentsSilently())
                        loadSilently(url);
                    else
                        load(url);
                }
            }
        }
    }
Esempio n. 24
0
/** Replaces the ImagesList::slotAddImages method, so that
  * MyImageListViewItems can be added instead of ImagesListViewItems
  */
void MyImageList::slotAddImages(const KUrl::List& list)
{
    // Figure out which of the supplied URL's should actually be added and which
    // of them already exist.
    bool found = false;

    for (KUrl::List::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
    {
        KUrl imageUrl = *it;
        found         = false;

        for (int i = 0; i < listView()->topLevelItemCount(); ++i)
        {
            MyImageListViewItem* const currItem = dynamic_cast<MyImageListViewItem*>(listView()->topLevelItem(i));

            if (currItem && currItem->url() == imageUrl)
            {
                found = true;
                break;
            }
        }

        if (!found && KPMetadata::isRawFile(imageUrl))
        {
            new MyImageListViewItem(listView(), imageUrl);
        }
    }

    // Duplicate the signalImageListChanged of the ImageWindow, to enable the
    // upload button again.
    emit signalImageListChanged();
}
Esempio n. 25
0
void PlaylistModel::processedTracks(const KUrl::List &tracks, int position, PlayerReaction reaction)
{
    for (int i = (tracks.count() - 1); i >= 0; --i)
    {
        m_tracks.insert(position, tracks.at(i));
    }

    if (reaction == PlayReaction)
    {
        setCurrentTrack(position, reaction);
    }
    else if (position <= m_currentTrack)
    {
        if (m_tracks.count() == tracks.count())
        {
            setCurrentTrack(0, reaction);
        }
        else
        {
            setCurrentTrack(qMin((m_currentTrack + tracks.count()), (m_tracks.count() - 1)), reaction);
        }
    }

    MetaDataManager::resolveTracks(tracks);

    emit tracksChanged();
    emit modified();
}
Esempio n. 26
0
void ScanGallery::slotUrlsDropped(QDropEvent *ev, FileTreeViewItem *item)
{
    KUrl::List urls = ev->mimeData()->urls();
    if (urls.isEmpty()) return;

    kDebug() << "onto" << (item==NULL ? "NULL" : item->url().prettyUrl())
             << "srcs" << urls.count() << "first" << urls.first();
    
    if (item==NULL) return;
    KUrl dest = item->url();

    // Check whether the drop is on top of a directory (in which case we
    // want to move/copy into it) or a file (move/copy into its containing
    // directory).
    if (!item->isDir()) dest.setFileName(QString::null);
    dest.adjustPath(KUrl::AddTrailingSlash);
    kDebug() << "resolved destination" << dest;

    // Make the last URL to copy the one to select next
    KUrl nextSel = dest;
    nextSel.addPath(urls.back().fileName(KUrl::ObeyTrailingSlash));
    m_nextUrlToShow = nextSel;

    KIO::Job *job;
    // TODO: top level window as 3rd parameter?
    if (ev->dropAction()==Qt::MoveAction) job = KIO::move(urls, dest);
    else job = KIO::copy(urls, dest);
    connect(job, SIGNAL(result(KJob *)), SLOT(slotJobResult(KJob *)));
}
Esempio n. 27
0
//-----------------------------------------------------------------------------
void SplashInstaller::slotFilesDropped(const KUrl::List &urls)
{
  for(KUrl::List::ConstIterator it = urls.constBegin();
      it != urls.end();
      ++it)
      addNewTheme(*it);
}
Esempio n. 28
0
void QuickButton::mouseMoveEvent(QMouseEvent *e)
{
    if((e->state() & LeftButton) == 0)
        return;
    QPoint p(e->pos() - _dragPos);
    if(p.manhattanLength() <= KGlobalSettings::dndEventDelay())
        return;
    DEBUGSTR << "dragstart" << endl << flush;
    setDown(false);
    if(_dragEnabled)
    {
        KURL::List uris;
        uris.append(_qurl->kurl());
        DEBUGSTR << "creating KURLDrag" << endl << flush;
        KURLDrag *dd = new KURLDrag(uris, this);
        dd->setPixmap(_icon); // PIX
        DEBUGSTR << "ready to drag" << endl << flush;
        grabKeyboard();
        dd->drag();
        releaseKeyboard();
    }
    else
    {
        setCursor(Qt::ForbiddenCursor);
    }
}
Esempio n. 29
0
void MrmlViewItem::mouseMoveEvent( QMouseEvent *e )
{
    if ( hitsPixmap( e->pos() ) ) {
        if ( !ownCursor() ) { // nice hacklet :)
            setCursor( KCursor::handCursor() );
            emit view()->onItem( m_url );
        }
    }
    else {
        if ( ownCursor() ) {
            unsetCursor();
            emit view()->onItem( KURL() );
        }
    }

    if ( (e->state() & LeftButton) && !pressedPos.isNull() ) {
        QPoint dist = e->pos() - pressedPos;
        if ( dist.manhattanLength() > KGlobalSettings::dndEventDelay() ) {
            // start drag here
            KURL::List urls;
            // ### support multiple files?
            urls.append( m_url );
            KURLDrag *drag = new KURLDrag( urls, this );
            drag->setPixmap( KMimeType::pixmapForURL( m_url ) );
            drag->drag();
        }
    }
}
Esempio n. 30
0
KURL::List ProjectNewLocal::files()
{
  //return fileList;
  KURL::List r;

  QListViewItem *item;
  QListViewItemIterator it(listView);
  for ( ; it.current(); ++it )
  {
   item = it.current();
   if ( listView->isSelected( item ))
   {
     KURL u;
     if (dynamic_cast<UploadTreeFolder*>(item))
     {
      u = dynamic_cast<UploadTreeFolder*>(item)->url();
     } else
     {
      u = dynamic_cast<UploadTreeFile*>(item)->url();
     }

     if (!u.isEmpty()) r.append(u);
   }
  }
  return r;
}