Esempio n. 1
0
// Right now, only one item for each action.
void subversionCore::svnLog( const KURL::List& list,
		int revstart, QString revKindStart, int revend, QString revKindEnd,
		bool discorverChangedPath, bool strictNodeHistory )
{
	// ensure that part has repository information. This info is used to retrieve root repository URL
    if( m_part->m_prjInfoMap.count() < 1 )
        clientInfo( KURL(m_part->project()->projectDirectory()), false, m_part->m_prjInfoMap );
	KURL servURL = m_part->baseURL();
	if ( servURL.isEmpty() ) servURL="kdevsvn+svn://blah/";
	if ( ! servURL.protocol().startsWith( "kdevsvn+" ) ) {
		servURL.setProtocol( "kdevsvn+" + servURL.protocol() ); //make sure it starts with "svn"
	}
	kdDebug(9036) << "servURL : " << servURL.prettyURL() << endl;
	QByteArray parms;
	QDataStream s( parms, IO_WriteOnly );
	// prepare arguments
	int cmd = 4;
// 	int revstart = -1, revend = 0;
// 	QString revKindStart = "HEAD", revKindEnd = "";
// 	bool repositLog = true, discorverChangedPath = true, strictNodeHistory = true;
	s << cmd << revstart << revKindStart << revend << revKindEnd;
	s << discorverChangedPath << strictNodeHistory;
	for ( QValueListConstIterator<KURL> it = list.begin(); it != list.end() ; ++it ) {
		kdDebug(9036) << "svnCore: adding to list: " << (*it).prettyURL() << endl;
		s << *it;
	}
	SimpleJob * job = KIO::special(servURL, parms, false);
	connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotLogResult( KIO::Job * ) ) );
	//  progress info. LogView is allowed and meaninful only for one url in KDev3.4
	initProcessDlg( (KIO::Job*)job, (*(list.begin())).prettyURL() , i18n("Subversion Log View") );
}
Esempio n. 2
0
void ProjectNewLocal::slotInsertFilesAfterCopying(const KURL::List& a_urlList)
{
  KURL::List::ConstIterator it;
  KURL u;
  progressBar->setTotalSteps(a_urlList.count() - 1);
  progressBar->setTextEnabled(true);
  for (it = a_urlList.begin(); it != a_urlList.end(); ++it)
  {
    u = QExtFileInfo::toRelative(*it, baseURL, false);
    if ( !fileList.contains(u))
    {
      fileList.append(u);
      QListViewItem *it = listView->addItem(u, KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
      if (it)
      {
         it->setSelected(true);
         listView->slotSelectFile(it);
      }
      progressBar->advance(1);
    }
  }
  progressBar->setTotalSteps(1);
  progressBar->setValue(0);
  progressBar->setTextEnabled(false);
}
Esempio n. 3
0
void ItemView::dropEvent(QDropEvent *event) {
	removeDragItem();

	KURL::List urls;

	if (KURLDrag::decode(event, urls)) {
		// Then it is URLs that we can decode :)
		const KURL::List::iterator end = urls.end();

		for (KURL::List::iterator it = urls.begin(); it != end; ++it) {
			DocManager::self()->openURL(*it);
		}

		return;
	}

	if (!QString(event->format()).startsWith("ktechlab/"))
		return;

	QString text;

	QDataStream stream(event->encodedData(event->format()), IO_ReadOnly);

	stream >> text;

	// Get a new component item
	p_itemDocument->addItem(text, mousePosToCanvasPos(event->pos()), true);

	setFocus();
}
Esempio n. 4
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. 5
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. 6
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. 7
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 );
}
bool ToolsConfigWidget::eventFilter(QObject *o, QEvent *e)
{
    if (e->type() == QEvent::DragEnter || e->type() == QEvent::DragMove) {
        QDragMoveEvent *dme = static_cast<QDragMoveEvent*>(e);
        if (KURLDrag::canDecode(dme))
            dme->accept();
        return true;
    } else if (e->type() == QEvent::Drop) {
        QDropEvent *de = static_cast<QDropEvent*>(e);
        KURL::List fileList;
        if (KURLDrag::decode(de, fileList)) {
            KURL::List::ConstIterator it;
            for (it = fileList.begin(); it != fileList.end(); ++it) {
                if ((*it).isLocalFile() && KDesktopFile::isDesktopFile((*it).path())) {
                    KDesktopFile df((*it).path());
                    ToolsConfigEntry *entry = new ToolsConfigEntry;
                    entry->menutext = df.readName();
                    entry->cmdline = (*it).path();
                    entry->isdesktopfile = true;
                    entry->captured = false;
                    addEntry(entry, &m_toolsmenuEntries);
                }
            }
        }
        return true;
    }

    return ToolsConfigWidgetBase::eventFilter(o, e);
}
Esempio n. 9
0
void ProjectNewLocal::slotInsertFolderAfterCopying(const KURL::List& a_urlList)
{
  KURL::List::ConstIterator it;
  KURL dirURL;
  for (it = a_urlList.begin(); it != a_urlList.end(); ++it)
  {
    dirURL = *it;
   // dirURL.adjustPath(1);
    KURL::List files = QExtFileInfo::allFilesRelative(dirURL, "*", this, false);
    progressBar->setTotalSteps(files.count() - 1);
    progressBar->setTextEnabled(true);
    KURL u;
    for (uint i = 0; i < files.count(); i++)
    {
      u = files[i];
      if ( !fileList.contains(u) && u.path() != "." && u.path() != ".." )
      {
        fileList.append(u);
        listView->addItem(u, KFileItem(KFileItem::Unknown, KFileItem::Unknown, KURL()));
        QListViewItem *it = listView->itemByUrl(u);
        if (it)
        {
          it->setSelected(true);
          listView->slotSelectFile(it);
        }
        progressBar->setValue(i);
      }
    }
    //listView->selectAll(false);
    progressBar->setTotalSteps(1);
    progressBar->setValue(0);
    progressBar->setTextEnabled(false);
  }
}
Esempio n. 10
0
void K3bExporter::exportViaCmdLine( const KURL::List &urls, int openmode )
{
    QCString cmdOption;

    switch( openmode ) {
    case AudioCD:
        cmdOption = "--audiocd";
        break;

    case DataCD:
        cmdOption = "--datacd";
        break;

    case Abort:
        return;
    }

    KProcess *process = new KProcess;

    *process << "k3b";
    *process << cmdOption;

    KURL::List::ConstIterator it;
    KURL::List::ConstIterator end( urls.end() );
    for( it = urls.begin(); it != end; ++it )
        *process << ( *it ).path();

    if( !process->start( KProcess::DontCare ) )
        KMessageBox::error( 0, i18n("Unable to start K3b.") );
}
Esempio n. 11
0
void WmWidget::slotRemoveImagesDesc(const KUrl::List urls)
{
    for (KUrl::List::const_iterator it = urls.begin(); it != urls.end(); ++it)
    {
        QString path = (*it).path();
        d->imagesDescInfo.remove(path);
        kDebug() << "Remove" << path << "; new length:" << d->imagesDescInfo.size();
    }
}
Esempio n. 12
0
int K3bDataUrlAddingDialog::addUrls( const KURL::List& urls,
				     K3bDirItem* dir,
				     QWidget* parent )
{
  if( urls.isEmpty() )
    return 0;

  //
  // A common mistake by beginners is to try to burn an iso image
  // with a data project. Let's warn them
  //
  if( urls.count() == 1 ) {
    K3bIso9660 isoF( urls.first().path() );
    if( isoF.open() ) {
     if( KMessageBox::warningYesNo( parent,
				    i18n("<p>The file you are about to add to the project is an ISO9660 image. As such "
					 "it can be burned to a medium directly since it already contains a file "
					 "system.<br>"
					 "Are you sure you want to add this file to the project?"),
				    i18n("Adding image file to project"),
				    i18n("Add the file to the project"),
				    i18n("Burn the image directly") ) == KMessageBox::No ) {
       // very rough dvd image size test
       if( K3b::filesize( urls.first() ) > 1000*1024*1024 )
	 k3bappcore->k3bMainWindow()->slotWriteDvdIsoImage( urls.first() );
       else
	 k3bappcore->k3bMainWindow()->slotWriteCdImage( urls.first() );
       return 0;
     }
    }
  }

  K3bDataUrlAddingDialog dlg( dir->doc(), parent );
  dlg.m_urls = urls;
  for( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it )
    dlg.m_urlQueue.append( qMakePair( K3b::convertToLocalUrl(*it), dir ) );

  dlg.slotAddUrls();
  int ret = QDialog::Accepted;
  if( !dlg.m_urlQueue.isEmpty() ) {
    dlg.m_dirSizeJob->setUrls( urls );
    dlg.m_dirSizeJob->setFollowSymlinks( dir->doc()->isoOptions().followSymbolicLinks() );
    dlg.m_dirSizeJob->start();
    ret = dlg.exec();
  }

  // make sure the dir size job is finished
  dlg.m_dirSizeJob->cancel();
  K3bSignalWaiter::waitForJob( dlg.m_dirSizeJob );

  QString message = dlg.resultMessage();
  if( !message.isEmpty() )
    KMessageBox::detailedSorry( parent, i18n("Problems while adding files to the project."), message );

  return ret;
}
Esempio n. 13
0
void CollectionDialog::addSong()
{
  KURL::List urls = KFileDialog::getOpenURLs(":MidiFiles",
      "*.kar *.mid *.kar.gz *.mid.gz\n*.kar *.kar.gz\n*.mid *.mid.gz\n*",this);

  KURL::List::Iterator it;
  for( it = urls.begin(); it != urls.end(); ++it )
	addSong(*it);

}
Esempio n. 14
0
void panaWidget::dropEvent(QDropEvent* event)
{
    KURL::List urlList;
    if( KURLDrag::decode(event, urlList) )
    {
        KURL::List::iterator it;
        KURL::List::iterator end( urlList.end() );
        for (it = urlList.begin(); it != end; ++it )
            emit emitURL(*it);
    }
}
Esempio n. 15
0
void KuickShow::slotDropped( const KFileItem *, QDropEvent *, const KURL::List &urls)
{
    KURL::List::ConstIterator it = urls.begin();
    for ( ; it != urls.end(); ++it )
    {
        KFileItem item( KFileItem::Unknown, KFileItem::Unknown, *it );
        if ( FileWidget::isImage( &item ) )
            showImage( &item, true );
        else
            fileWidget->setURL( *it, true );
    }
}
Esempio n. 16
0
void Project::slotInsertFilesAfterCopying(const KURL::List& a_urlList)
{
  KURL::List::ConstIterator it;
  KURL url;
  for (it = a_urlList.begin(); it != a_urlList.end(); ++it)
  {
    url = *it;
    //url.adjustPath(1);
    d->insertFiles( url, "*" );
  }
  emit reloadTree( &(d->m_projectFiles), false, QStringList() );
}
Esempio n. 17
0
void QuickLauncher::dragEnterEvent(TQDragEnterEvent *e)
{
    DEBUGSTR << "QuickLauncher::dragEnterEvent(pos=" << e->pos() << 
        " type=" << e->type() << ")" << endl << flush;
    m_dragAccepted=false;
    KURL::List kurlList;
    if (!isDragEnabled() || !KURLDrag::decode(e, kurlList)) 
    {
        e->accept(false);
        return;
    }

    if (kurlList.size()<=0)
    {
        e->accept(false);
        return;
    }
    m_dragButtons=new ButtonGroup;
    m_oldButtons=new ButtonGroup(*m_buttons);

    TQString url;
    KURL::List::ConstIterator it = kurlList.begin();
    for ( ; it != kurlList.end(); ++it )
    {
        url = QuickURL((*it).url()).url();
        kdDebug() << "    Drag Object='"<<url<<"' " << (*it).url() << endl;
        int pos = m_buttons->findDescriptor(url);
        if (pos != NotFound)
        {
            // if it's already in m_buttons, take it out
            m_dragButtons->push_back(m_buttons->takeFrom(pos));
        }
        else
        {
            // otherwise, create a new one
            QuickButton* button = createButton(url);
            button->setSticky(true);
            m_dragButtons->push_back(button);
        }
    }
    if (m_dragButtons->size() > 0)
    {
        //make sure we can drag at least one button.
        m_dragAccepted=true;
        m_newButtons=new ButtonGroup(*m_buttons);
        m_dropPos=NotFound;
        e->accept(true);
        return;
    }
    e->accept(false);
    clearTempButtons();
}
Esempio n. 18
0
//BEGIN class LinkerOptionsDlg
LinkerOptionsDlg::LinkerOptionsDlg( LinkerOptions * linkingOptions, QWidget *parent )
	: KDialogBase( parent, "Linker Options Dialog", true, "Linker Options", KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
{
	m_pLinkerOptions = linkingOptions;
	m_pWidget = new LinkerOptionsWidget(this);
	
	ProjectInfo * pi = ProjectManager::self()->currentProject();
	assert(pi);
	
	
	//BEGIN Update gplink options
	m_pWidget->m_pHexFormat->setCurrentItem( m_pLinkerOptions->hexFormat() );
	m_pWidget->m_pOutputMap->setChecked( m_pLinkerOptions->outputMapFile() );
	m_pWidget->m_pLibraryDir->setText( m_pLinkerOptions->libraryDir() );
	m_pWidget->m_pLinkerScript->setText( m_pLinkerOptions->linkerScript() );
	m_pWidget->m_pOther->setText( m_pLinkerOptions->linkerOther() );
	//END Update gplink options
	
	
	
	//BEGIN Update library widgets
	const KURL::List availableInternal = pi->childOutputURLs( ProjectItem::LibraryType );
	const QStringList linkedInternal = m_pLinkerOptions->linkedInternal();
	
	KURL::List::const_iterator end = availableInternal.end();
	for ( KURL::List::const_iterator it = availableInternal.begin(); it != end; ++it )
	{
		QString relativeURL = KURL::relativeURL( pi->url(), *it );
		QCheckListItem * item = new QCheckListItem( m_pWidget->m_pInternalLibraries, relativeURL, QCheckListItem::CheckBox );
		item->setOn( linkedInternal.contains(relativeURL) );
	}
	
	m_pExternalLibraryRequester = new KURLRequester( 0l );
	m_pExternalLibraryRequester->fileDialog()->setURL( "/usr/share/sdcc/lib" );
	
	delete m_pWidget->m_pExternalLibraries;
	m_pWidget->m_pExternalLibraries = new KEditListBox( i18n("Link libraries outside project"), m_pExternalLibraryRequester->customEditor(), m_pWidget );
	m_pWidget->m_pExternalLibraries->layout()->setMargin(11);
	(dynamic_cast<QGridLayout*>(m_pWidget->layout()))->addMultiCellWidget( m_pWidget->m_pExternalLibraries, 7, 7, 0, 1 );
	
#if defined(KDE_MAKE_VERSION)
# if KDE_VERSION >= KDE_MAKE_VERSION(3,4,0)
	m_pWidget->m_pExternalLibraries->setButtons( KEditListBox::Add | KEditListBox::Remove );
# endif
#endif
	m_pWidget->m_pExternalLibraries->insertStringList( m_pLinkerOptions->linkedExternal() );
	//END Update library widgets
	
	
	setMainWidget( m_pWidget );
	setInitialSize( m_pWidget->rect().size() );
}
Esempio n. 19
0
void subversionCore::commit( const KURL::List& list, bool recurse, bool keeplocks ) {
	KURL servURL = m_part->baseURL();
	if ( servURL.isEmpty() ) servURL="kdevsvn+svn://blah/";
	if ( ! servURL.protocol().startsWith( "kdevsvn+" ) ) {
		servURL.setProtocol( "kdevsvn+" + servURL.protocol() ); //make sure it starts with "svn"
	}
	kdDebug(9036) << "servURL : " << servURL.prettyURL() << endl;
	QByteArray parms;
	QDataStream s( parms, IO_WriteOnly );
	int cmd = 103;
 	s << cmd << recurse << keeplocks;
	for ( QValueListConstIterator<KURL> it = list.begin(); it != list.end() ; ++it ) {
		kdDebug(9036) << "adding to list: " << (*it).prettyURL() << endl;
		s << *it;
	}
	SimpleJob * job = KIO::special(servURL, parms, false);
	connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) );
	if( list.count() == 1 )
		initProcessDlg( (KIO::Job*)job, (*(list.begin())).prettyURL() , i18n("Commit to remote repository") );
	else if( list.count() > 1 )
		initProcessDlg( (KIO::Job*)job, i18n("From working copy") , i18n("Commit to remote repository") );
}
Esempio n. 20
0
KURL::List QExtFileInfo::allFilesRelative( const KURL& path, const QString& mask)
{
  QExtFileInfo internalFileInfo;
  KURL::List r = internalFileInfo.allFilesInternal( path, mask);

  KURL::List::Iterator it;
  for ( it = r.begin(); it != r.end(); ++it )
  {
    *it = QExtFileInfo::toRelative( *it, path );
  }

  return r;
}
Esempio n. 21
0
void DeleteWidget::setFiles(const KURL::List &files)
{
    ddFileList->clear();
//    ddFileList->insertStringList(files);
    for( KURL::List::ConstIterator it = files.begin(); it != files.end(); it++)
    {
        if( (*it).isLocalFile() ) //path is nil for non-local
            ddFileList->insertItem( (*it).path() );
        else
            ddFileList->insertItem( (*it).url() );
    }
    ddNumFiles->setText(i18n("<b>1</b> file selected.", "<b>%n</b> files selected.", files.count()));
}
Esempio n. 22
0
ASYNC RemoteMenu::FilesRemoved(const KURL::List &fileList)
{
    KURL::List::ConstIterator it = fileList.begin();
    KURL::List::ConstIterator end = fileList.end();
    
    for (; it!=end; ++it)
    {
        if ((*it).protocol()=="remote")
        {
            reinitialize();
            return;
        }
    }
}
Esempio n. 23
0
void KonqSidebarTree::FilesRemoved( const KURL::List & urls )
{
    //kdDebug(1201) << "KonqSidebarTree::FilesRemoved " << urls.count() << endl;
    for ( KURL::List::ConstIterator it = urls.begin() ; it != urls.end() ; ++it )
    {
        //kdDebug(1201) <<  "KonqSidebarTree::FilesRemoved " << (*it).prettyURL() << endl;
        if ( m_dirtreeDir.dir.isParentOf( *it ) )
        {
            QTimer::singleShot( 0, this, SLOT( rescanConfiguration() ) );
            kdDebug(1201) << "KonqSidebarTree::FilesRemoved done" << endl;
            return;
        }
    }
}
void K2sendPlayList::insertDroppedEvent(QDropEvent *event, QListViewItem *p, QListViewItem *after)
{
    KURL::List urls;
    if (KURLDrag::decode(event, urls) && !urls.isEmpty()){
        KURL::List::iterator it;
        for ( it = urls.begin(); it != urls.end(); ++it ){
            if ((*it).isLocalFile()){
                add((*it).path(),(K2sendPlayListItem*)after);
            }
        }
    }
    QString msg = QString("%1 Files").arg(this->childCount());
    emit signalChangeStatusbar(msg);
}
Esempio n. 25
0
void BGMultiWallpaperList::dropEvent(QDropEvent *ev)
{
   QStringList files;
   KUrl::List urls;
   K3URLDrag::decode(ev, urls);
   for(KUrl::List::ConstIterator it = urls.begin();
       it != urls.end(); ++it)
   {
      // TODO: Download remote files
      if ((*it).isLocalFile())
          files.append((*it).path());
   }
   addItems(files);
}
Esempio n. 26
0
void ActionThread::identifyRawFiles(const KUrl::List& urlList, bool full)
{
    for (KUrl::List::const_iterator it = urlList.begin();
         it != urlList.end(); ++it ) 
    {
        ActionThreadPriv::Task *t = new ActionThreadPriv::Task;
        t->fileUrl                = *it;
        t->action                 = full ? IDENTIFY_FULL : IDENTIFY;

        QMutexLocker lock(&d->mutex);
        d->todo << t;
        d->condVar.wakeAll();
    }
}
Esempio n. 27
0
void ActionThread::thumbRawFiles(const KUrl::List& urlList)
{
    for (KUrl::List::const_iterator it = urlList.begin();
         it != urlList.end(); ++it ) 
    {
        ActionThreadPriv::Task *t = new ActionThreadPriv::Task;
        t->fileUrl                = *it;
        t->action                 = THUMBNAIL;

        QMutexLocker lock(&d->mutex);
        d->todo << t;
        d->condVar.wakeAll();
    }
}
void BookmarksListBox::dropEvent( QDropEvent *event )
{
    KURL::List urls;
    if (KURLDrag::decode(event, urls) && !urls.isEmpty()) {
        KBookmarkManager* manager = DolphinSettings::instance().bookmarkManager();
        KBookmarkGroup root = manager->root();

        KURL::List::iterator it;
        for(it=urls.begin(); it!=urls.end(); ++it) {
            root.addBookmark(manager, (*it).fileName(), (*it), "", false);
	}
	manager->emitChanged(root);
    }
}
Esempio n. 29
0
void BatchDialog::addItems(const KUrl::List& itemList)
{
    QString ext;

    switch(d->saveSettingsBox->fileFormat())
    {
        case SaveSettingsWidget::OUTPUT_JPEG:
            ext = "jpg";
            break;
        case SaveSettingsWidget::OUTPUT_TIFF:
            ext = "tif";
            break;
        case SaveSettingsWidget::OUTPUT_PPM:
            ext = "ppm";
            break;
        case SaveSettingsWidget::OUTPUT_PNG:
            ext = "png";
            break;
    }

    KUrl::List urlList;

    QPixmap pix(SmallIcon("image-x-generic", KIconLoader::SizeLarge, KIconLoader::DisabledState));

    for (KUrl::List::const_iterator  it = itemList.begin();
         it != itemList.end(); ++it)
    {
        KUrl url = *it;
        QFileInfo fi(url.path());
        if (fi.exists() && !findItem(url))
        {
            QString dest = fi.baseName() + QString(".") + ext;
            new CListViewItem(d->listView, pix, url, dest);
            urlList.append(url);
        }
    }

    if (!urlList.empty())
    {
        if (!d->iface->hasFeature(KIPI::HostSupportsThumbnails))
            d->thread->thumbRawFiles(urlList);
        else
            d->iface->thumbnails(urlList, 256);

        d->thread->identifyRawFiles(urlList);
        if (!d->thread->isRunning())
            d->thread->start();
    }
}
Esempio n. 30
0
void KonqOperations::_del( Operation method, const KUrl::List & _selectedUrls, ConfirmationType confirmation )
{
    KUrl::List selectedUrls;
    for (KUrl::List::ConstIterator it = _selectedUrls.begin(); it != _selectedUrls.end(); ++it)
        if (KProtocolManager::supportsDeleting(*it))
            selectedUrls.append(*it);
    if (selectedUrls.isEmpty()) {
        delete this; // this one is ok, _del is always called directly
        return;
    }

    if ( confirmation == SKIP_CONFIRMATION || askDeleteConfirmation( selectedUrls, method, confirmation, parentWidget() ) )
    {
        //m_srcUrls = selectedUrls;
        KIO::Job *job;
        m_method = method;
        switch( method )
        {
        case TRASH:
        {
            job = KIO::trash( selectedUrls );
            KIO::FileUndoManager::self()->recordJob( KIO::FileUndoManager::Trash, selectedUrls, KUrl("trash:/"), job );
            break;
        }
        case EMPTYTRASH:
        {
            // Same as in ktrash --empty
            QByteArray packedArgs;
            QDataStream stream( &packedArgs, QIODevice::WriteOnly );
            stream << (int)1;
            job = KIO::special( KUrl("trash:/"), packedArgs );
            KNotification::event("Trash: emptied", QString() , QPixmap() , 0l, KNotification::DefaultEvent );
            break;
        }
        case DEL:
            job = KIO::del( selectedUrls );
            break;
        default:
            kWarning() << "Unknown operation: " << method ;
            delete this; // this one is ok, _del is always called directly
            return;
        }
        job->ui()->setWindow(parentWidget());
        connect( job, SIGNAL(result(KJob*)),
                 SLOT(slotResult(KJob*)) );
    } else {
        delete this; // this one is ok, _del is always called directly
    }
}