Esempio n. 1
0
void KuickShow::delayAction(DelayedRepeatEvent *event)
{
    if (m_delayedRepeatItem)
        return;

    m_delayedRepeatItem = event;

    KURL url = event->viewer->currentFile()->url();
//    QFileInfo fi( event->viewer->filename() );
//    start.setPath( fi.dirPath( true ) );
    initGUI( url.upURL() );

    // see eventFilter() for explanation and similar code
    if ( fileWidget->dirLister()->isFinished() &&
         fileWidget->dirLister()->rootItem() )
    {
        fileWidget->setCurrentItem( url.fileName() );
        QTimer::singleShot( 0, this, SLOT( doReplay()));
    }
    else
    {
        fileWidget->setInitialItem( url.fileName() );
        connect( fileWidget, SIGNAL( finished() ),
                 SLOT( doReplay() ));
    }
}
Esempio n. 2
0
void DolphinView::rename(const KURL& source, const QString& newName)
{
    bool ok = false;

    if (newName.isEmpty() || (source.fileName() == newName)) {
        return;
    }

    KURL dest(source.upURL());
    dest.addPath(newName);

    const bool destExists = KIO::NetAccess::exists(dest,
                                                   false,
                                                   Dolphin::mainWin().activeView());
    if (destExists) {
        // the destination already exists, hence ask the user
        // how to proceed...
        KIO::RenameDlg renameDialog(this,
                                    i18n("File Already Exists"),
                                    source.path(),
                                    dest.path(),
                                    KIO::M_OVERWRITE);
        switch (renameDialog.exec()) {
            case KIO::R_OVERWRITE:
                // the destination should be overwritten
                ok = KIO::NetAccess::file_move(source, dest, -1, true);
                break;

            case KIO::R_RENAME: {
                // a new name for the destination has been used
                KURL newDest(renameDialog.newDestURL());
                ok = KIO::NetAccess::file_move(source, newDest);
                break;
            }

            default:
                // the renaming operation has been canceled
                reload();
                return;
        }
    }
    else {
        // no destination exists, hence just move the file to
        // do the renaming
        ok = KIO::NetAccess::file_move(source, dest);
    }

    if (ok) {
        m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.").arg(source.fileName(), dest.fileName()),
                                DolphinStatusBar::OperationCompleted);

        DolphinCommand command(DolphinCommand::Rename, source, dest);
        UndoManager::instance().addCommand(command);
    }
    else {
        m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.").arg(source.fileName(), dest.fileName()),
                                DolphinStatusBar::Error);
        reload();
    }
}
Esempio n. 3
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. 4
0
void tdeio_isoProtocol::stat( const KURL & url )
{
    TQString path;
    UDSEntry entry;

    kdDebug() << "tdeio_isoProtocol::stat " << url.url() << endl;
    if ( !checkNewFile( url.path(), path, url.hasRef() ? url.htmlRef().toInt() : -1 ) )
    {
        // We may be looking at a real directory - this happens
        // when pressing up after being in the root of an archive
        TQCString _path( TQFile::encodeName(url.path()));
        kdDebug()  << "tdeio_isoProtocol::stat (stat) on " << _path << endl;
        struct stat buff;
        if ( ::stat( _path.data(), &buff ) == -1 || !S_ISDIR( buff.st_mode ) ) {
            kdDebug() << "isdir=" << S_ISDIR( buff.st_mode ) << "  errno=" << strerror(errno) << endl;
            error( TDEIO::ERR_DOES_NOT_EXIST, url.path() );
            return;
        }
        // Real directory. Return just enough information for KRun to work
        UDSAtom atom;
        atom.m_uds = TDEIO::UDS_NAME;
        atom.m_str = url.fileName();
        entry.append( atom );
        kdDebug()  << "tdeio_isoProtocol::stat returning name=" << url.fileName() << endl;

        atom.m_uds = TDEIO::UDS_FILE_TYPE;
        atom.m_long = buff.st_mode & S_IFMT;
        entry.append( atom );

        statEntry( entry );

        finished();

        // And let go of the iso file - for people who want to unmount a cdrom after that
        delete m_isoFile;
        m_isoFile = 0L;
        return;
    }

    const KArchiveDirectory* root = m_isoFile->directory();
    const KArchiveEntry* isoEntry;
    if ( path.isEmpty() )
    {
        path = TQString::fromLatin1( "/" );
        isoEntry = root;
    } else {
        isoEntry = root->entry( path );
    }
    if ( !isoEntry )
    {
        error( TDEIO::ERR_DOES_NOT_EXIST, path );
        return;
    }
    createUDSEntry( isoEntry, entry );
    statEntry( entry );
    finished();
}
Esempio n. 5
0
bool KVerbosDoc::openDocument(const KURL& url, const char *format /*=0*/)
{
	bool b = false;
	QString tmpfile;
	KIO::NetAccess::download( url, tmpfile );

	QFile file(url.path());
	if ( file.open(IO_ReadOnly) ) {    // file opened successfully
		deleteContents();
	if ((url.fileName().right(4) == "html")||(url.fileName().right(3) == "htm"))
	{
		// qWarning("öffnen eines HTML-files");
		b = openDocHTML(file);
	}
	else
	{
		// qWarning("öffnen eines .verbos-files");
		b = openDocVERBOS(file);
	};
	file.close();
	// Liste der Verben sortieren
    spanishVerbList vl;
    spanishVerbList::Iterator it1 = verbList2.begin();
    spanishVerbList::Iterator it2;
   	while (it1 != verbList2.end())
    {
			it2 = vl.begin();
   		bool inserted = false;
   		while (it2  != vl.end())
     	{
				if (*it1 < *it2)
    		{
        	vl.insert(it2, *it1);
         	inserted = true;
          it2 = vl.end();
      	}
	      else
  	      it2++;
      };
      if (!inserted)
      	vl.insert(it2, *it1);
      it1++;
    };
    verbList2.clear();
    verbList2 = vl;
    benutzer->fillList(getList());  	
    emit changeView();
  };

  KIO::NetAccess::removeTempFile( tmpfile );

  modified=false;
  emit anzahlVerbenGeaendert(getAnzahl());
  return b;
}
Esempio n. 6
0
void RubySupportPart::contextMenu( QPopupMenu * popup, const Context * context )
{
    if (context->hasType(Context::FileContext)){
        const FileContext *fc = static_cast<const FileContext*>(context);
        //this is a .ui file and only selection contains only one such file
        KURL url = fc->urls().first();
        if (url.fileName().endsWith(".ui"))
        {
            m_contextFileName = url.fileName();
            int id = popup->insertItem(i18n("Create or Select Implementation..."), this, SLOT(slotCreateSubclass()));
            popup->setWhatsThis(id, i18n("<b>Create or select implementation</b><p>Creates or selects a subclass of selected form for use with integrated KDevDesigner."));
        }
    }
}
Esempio n. 7
0
bool KTheme::load( const KURL & url )
{
    kdDebug() << "Loading theme from URL: " << url << endl;

    QString tmpFile;
    if ( !KIO::NetAccess::download( url, tmpFile, 0L ) )
        return false;

    kdDebug() << "Theme is in temp file: " << tmpFile << endl;

    // set theme's name
    setName( QFileInfo( url.fileName() ).baseName() );

    // unpack the tarball
    QString location = m_kgd->saveLocation( "themes",  m_name + "/" );
    KTar tar( tmpFile );
    tar.open( IO_ReadOnly );
    tar.directory()->copyTo( location );
    tar.close();

    // create the DOM
    QFile file( location + m_name + ".xml" );
    file.open( IO_ReadOnly );
    m_dom.setContent( file.readAll() );
    file.close();

    // remove the temp file
    KIO::NetAccess::removeTempFile( tmpFile );

    return true;
}
Esempio n. 8
0
void JobTest::copyLocalDirectory(const QString &src, const QString &_dest, int flags)
{
    assert(QFileInfo(src).isDir());
    assert(QFileInfo(src + "/testfile").isFile());
    KURL u;
    u.setPath(src);
    QString dest(_dest);
    KURL d;
    d.setPath(dest);
    if(flags & AlreadyExists)
        assert(QFile::exists(dest));
    else
        assert(!QFile::exists(dest));

    bool ok = KIO::NetAccess::dircopy(u, d, 0);
    assert(ok);

    if(flags & AlreadyExists)
    {
        dest += "/" + u.fileName();
        // kdDebug() << "Expecting dest=" << dest << endl;
    }

    assert(QFile::exists(dest));
    assert(QFileInfo(dest).isDir());
    assert(QFileInfo(dest + "/testfile").isFile());
    assert(QFile::exists(src)); // still there
    {
        // check that the timestamp is the same (#24443)
        QFileInfo srcInfo(src);
        QFileInfo destInfo(dest);
        assert(srcInfo.lastModified() == destInfo.lastModified());
    }
}
Esempio n. 9
0
void TDMAppearanceWidget::iconLoaderDropEvent(TQDropEvent *e)
{
    KURL pixurl;
    bool istmp;

    KURL *url = decodeImgDrop(e, this);
    if (url) {

	// we gotta check if it is a non-local file and make a tmp copy at the hd.
	if(!url->isLocalFile()) {
	    pixurl.setPath(TDEGlobal::dirs()->resourceDirs("data").last() +
		     "tdm/pics/" + url->fileName());
	    TDEIO::NetAccess::copy(*url, pixurl, parentWidget());
	    istmp = true;
	} else {
	    pixurl = *url;
	    istmp = false;
	}

	// By now url should be "file:/..."
	if (!setLogo(pixurl.path())) {
	    TDEIO::NetAccess::del(pixurl, parentWidget());
	    TQString msg = i18n("There was an error loading the image:\n"
			       "%1\n"
			       "It will not be saved.")
			       .arg(pixurl.path());
	    KMessageBox::sorry(this, msg);
	}

	delete url;
    }
}
Esempio n. 10
0
void RemoteProtocol::rename(const KURL &src, const KURL &dest, bool overwrite)
{
    if(src.protocol() != "remote" || dest.protocol() != "remote" || m_impl.isWizardURL(src) || m_impl.isWizardURL(dest))
    {
        error(KIO::ERR_UNSUPPORTED_ACTION, src.prettyURL());
        return;
    }

    if(m_impl.renameFolders(src.fileName(), dest.fileName(), overwrite))
    {
        finished();
        return;
    }

    error(KIO::ERR_CANNOT_RENAME, src.prettyURL());
}
Esempio n. 11
0
void AntProjectPart::contextMenu(QPopupMenu *popup, const Context *context)
{
  if (!context->hasType( Context::FileContext ))
    return;

  const FileContext *fcontext = static_cast<const FileContext*>(context);
  KURL url = fcontext->urls().first();
  if (URLUtil::isDirectory(url))
    return;

  m_contextFileName = url.fileName();
  bool inProject = project()->allFiles().contains(m_contextFileName.mid ( project()->projectDirectory().length() + 1 ) );
  QString popupstr = QFileInfo(m_contextFileName).fileName();
  if (m_contextFileName.startsWith(projectDirectory()+ "/"))
    m_contextFileName.remove(0, projectDirectory().length()+1);

  popup->insertSeparator();
  if (inProject)
  {
    int id = popup->insertItem( i18n("Remove %1 From Project").arg(popupstr),
                       this, SLOT(slotRemoveFromProject()) );
    popup->setWhatsThis(id, i18n("<b>Remove from project</b><p>Removes current file from the project."));
  }
  else
  {
    int id = popup->insertItem( i18n("Add %1 to Project").arg(popupstr),
                       this, SLOT(slotAddToProject()) );
    popup->setWhatsThis(id, i18n("<b>Add to project</b><p>Adds current file from the project."));
  }
}
Esempio n. 12
0
AtomicURL::AtomicURL( const KURL &url )
{
    if( url.isEmpty() )
        return;

    QString s = url.protocol() + "://";
    QString host = url.host();
    if( url.hasUser() )
    {
        s += url.user();
        host.prepend("@");
    }
    if( url.hasPass() )
        s += ':' + url.pass();
    if( url.port() )
        host += QString(":") + QString::number( url.port() );

    m_beginning = s + host;
    m_directory = url.directory();
    m_filename = url.fileName();
    m_end = url.query();
    if( url.hasRef() )
        m_end += QString("#") + url.ref();
    if (url != this->url())
    {
        debug() << "from: " << url << endl;
        debug() << "to:   " << this->url() << endl;
    }
}
Esempio n. 13
0
void ProgressItem::setStating(const KURL &url)
{
    setText(ListProgress::TB_OPERATION, i18n("Examining"));
    setText(ListProgress::TB_ADDRESS, url.url());
    setText(ListProgress::TB_LOCAL_FILENAME, url.fileName());

    defaultProgress->slotStating(0, url);
}
Esempio n. 14
0
void ProgressItem::setMoving(const KURL &from, const KURL &to)
{
    setText(ListProgress::TB_OPERATION, i18n("Moving"));
    setText(ListProgress::TB_ADDRESS, from.url());
    setText(ListProgress::TB_LOCAL_FILENAME, to.fileName());

    defaultProgress->slotMoving(0, from, to);
}
void YahooVerifyAccount::setUrl( KURL url )
{
	mFile = new KTempFile( locateLocal( "tmp", url.fileName() ) );
	mFile->setAutoDelete( true );
	KIO::TransferJob *transfer = KIO::get( url, false, false );
	connect( transfer, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotComplete( KIO::Job* ) ) );
	connect( transfer, SIGNAL( data( KIO::Job*, const QByteArray& ) ), this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) );
}
Esempio n. 16
0
void KonqSidebarTree::addURL(KonqSidebarTreeTopLevelItem* item, const KURL & url)
{
    QString path;
    if (item)
       path = item->path();
    else
       path = m_dirtreeDir.dir.path();

    KURL destUrl;

    if (url.isLocalFile() && url.fileName().endsWith(".desktop"))
    {
       QString filename = findUniqueFilename(path, url.fileName());
       destUrl.setPath(filename);
       KIO::NetAccess::copy(url, destUrl, this);
    }
    else
    {
       QString name = url.host();
       if (name.isEmpty())
          name = url.fileName();
       QString filename = findUniqueFilename(path, name);
       destUrl.setPath(filename);

       KDesktopFile cfg(filename);
       cfg.writeEntry("Encoding", "UTF-8");
       cfg.writeEntry("Type","Link");
       cfg.writeEntry("URL", url.url());
       QString icon = "folder";
       if (!url.isLocalFile())
          icon = KMimeType::favIconForURL(url);
       if (icon.isEmpty())
          icon = KProtocolInfo::icon( url.protocol() );
       cfg.writeEntry("Icon", icon);
       cfg.writeEntry("Name", name);
       cfg.writeEntry("Open", false);
       cfg.sync();
    }

    KDirNotify_stub allDirNotify( "*", "KDirNotify*" );
    destUrl.setPath( destUrl.directory() );
    allDirNotify.FilesAdded( destUrl );

    if (item)
       item->setOpen(true);
}
Esempio n. 17
0
void ProgressItem::setCreatingDir(const KURL &dir)
{
    setText(ListProgress::TB_OPERATION, i18n("Creating"));
    setText(ListProgress::TB_ADDRESS, dir.url());
    setText(ListProgress::TB_LOCAL_FILENAME, dir.fileName());

    defaultProgress->slotCreatingDir(0, dir);
}
Esempio n. 18
0
FileListItem::FileListItem( QListView * parent, KURL const & url, DocumentState state )
	: QListViewItem( parent, url.fileName() ),
	_url( url )

{
	KFileItem fileItem( KFileItem::Unknown, KFileItem::Unknown, _url );
    _icon = fileItem.pixmap(KIcon::SizeSmall);
    setState( state );
}
Esempio n. 19
0
//===========================================================================
void SMBSlave::stat(const KURL &kurl)
{
    kdDebug(KIO_SMB) << "SMBSlave::stat on " << kurl << endl;
    // make a valid URL
    KURL url = checkURL(kurl);

    // if URL is not valid we have to redirect to correct URL
    if(url != kurl)
    {
        kdDebug() << "redirection " << url << endl;
        redirection(url);
        finished();
        return;
    }

    m_current_url = url;

    UDSAtom udsatom;
    UDSEntry udsentry;
    // Set name
    udsatom.m_uds = KIO::UDS_NAME;
    udsatom.m_str = kurl.fileName();
    udsentry.append(udsatom);

    switch(m_current_url.getType())
    {
        case SMBURLTYPE_UNKNOWN:
            error(ERR_MALFORMED_URL, m_current_url.prettyURL());
            finished();
            return;

        case SMBURLTYPE_ENTIRE_NETWORK:
        case SMBURLTYPE_WORKGROUP_OR_SERVER:
            udsatom.m_uds = KIO::UDS_FILE_TYPE;
            udsatom.m_long = S_IFDIR;
            udsentry.append(udsatom);
            break;

        case SMBURLTYPE_SHARE_OR_PATH:
            if(browse_stat_path(m_current_url, udsentry, false))
                break;
            else
            {
                kdDebug(KIO_SMB) << "SMBSlave::stat ERROR!!" << endl;
                finished();
                return;
            }
        default:
            kdDebug(KIO_SMB) << "SMBSlave::stat UNKNOWN " << url << endl;
            finished();
            return;
    }

    statEntry(udsentry);
    finished();
}
Esempio n. 20
0
KURL Proxy::realStreamUrl( KURL fakeStream, int sessionId )
{
    KURL realStream;
    realStream.setProtocol( "http" );
    realStream.setHost(fakeStream.host());
    realStream.setPort(fakeStream.port());
    realStream.setPath( "/databases" + fakeStream.directory() + "/items/" + fakeStream.fileName() );
    realStream.setQuery( QString("?session-id=") + QString::number(sessionId) );
    return realStream;
}
Esempio n. 21
0
void ServiceButton::slotSaveAs(const KURL &oldUrl, KURL &newUrl)
{
    QString oldPath = oldUrl.path();
    if (locateLocal("appdata", oldUrl.fileName()) != oldPath)
    {
       QString path = KickerLib::newDesktopFile(oldUrl);
       newUrl.setPath(path);
       _id = path;
    }
}
Esempio n. 22
0
bool
GstEngine::canDecode( const KURL &url ) const
{
    // TODO Consider using decodebin here as well

    // We had some bug reports claiming that video files cause crashes in canDecode(),
    // so don't try to decode them
    if ( url.fileName().lower().endsWith( ".mov" ) ||
         url.fileName().lower().endsWith( ".avi" ) ||
         url.fileName().lower().endsWith( ".wmv" ) )
        return false;

    int count = 0;
    m_canDecodeSuccess = false;
    GstElement *pipeline, *filesrc, *spider, *fakesink;

    if ( !( pipeline = createElement( "pipeline" ) ) ) return false;
    if ( !( filesrc = createElement( "filesrc", pipeline ) ) ) return false;
    if ( !( spider = createElement( "spider", pipeline ) ) ) return false;
    if ( !( fakesink = createElement( "fakesink", pipeline ) ) ) return false;

    GstCaps* filtercaps = gst_caps_new_simple( "audio/x-raw-int", NULL );

    gst_element_link( filesrc, spider );
    gst_element_link_filtered( spider, fakesink, filtercaps );

    gst_element_set( filesrc, "location", (const char*) QFile::encodeName( url.path() ), NULL );
    gst_element_set( fakesink, "signal_handoffs", true, NULL );
    g_signal_connect( G_OBJECT( fakesink ), "handoff", G_CALLBACK( candecode_handoff_cb ), pipeline );

    gst_element_set_state( pipeline, GST_STATE_PLAYING );

    // Try to iterate over the bin until signal "handoff" gets triggered
    while ( gst_bin_iterate( GST_BIN( pipeline ) ) && !m_canDecodeSuccess && count < 1000 )
        count++;

    gst_element_set_state( pipeline, GST_STATE_NULL );
    gst_object_unref( GST_OBJECT( pipeline ) );

    return m_canDecodeSuccess;
}
Esempio n. 23
0
void FilePreview::showPreview(const KURL &url)
{
    if (!url.isLocalFile()){
        showPreview(NULL);
        return;
    }
    QString fileName = url.directory(false, false);
    if (!fileName.isEmpty() && (fileName[fileName.length() - 1] != '/'))
        fileName += '/';
    fileName += url.fileName(false);
    showPreview((const char*)fileName.local8Bit());
}
Esempio n. 24
0
void RemoteProtocol::del(const KURL &url, bool /*isFile*/)
{
    kdDebug(1220) << "RemoteProtocol::del: " << url << endl;

    if(!m_impl.isWizardURL(url) && m_impl.deleteNetworkFolder(url.fileName()))
    {
        finished();
        return;
    }

    error(KIO::ERR_CANNOT_DELETE, url.prettyURL());
}
Esempio n. 25
0
// sichert die Datei. Die Verben werden in einer Datei im HTML Format gespeichert.
bool KVerbosDoc::saveDocument(const KURL& url, const char *format /*=0*/)
{
	bool b = false;
	QFile file(url.path());
	if ( file.open(IO_WriteOnly) )
	{    // file opened successfully
		if ((url.fileName().right(4) == "html")||(url.fileName().right(3) == "htm"))
		{
			// qWarning("als HTML speichern");
			b = saveDocHTML(file);
		}
		else
		{
			// qWarning("als .verbos speichern");    	
			b = saveDocVERBOS(file);
		};
	};
	file.close();
	modified=false;
	return b;
}
Esempio n. 26
0
Item::Item( QListViewItem *parent, const KURL &url )
    : QCheckListItem( parent, url.fileName(), QCheckListItem::CheckBox  )
    , m_lister( true )
    , m_url( url )
    , m_listed( false )
{
    m_lister.setDirOnlyMode( true );
    setExpandable( true );
    connect( &m_lister, SIGNAL(newItems( const KFileItemList& )), SLOT(newItems( const KFileItemList& )) );
    connect( &m_lister, SIGNAL(completed()), SLOT(completed()) );
    connect( &m_lister, SIGNAL(canceled()), SLOT(completed()) );
}
Esempio n. 27
0
void AtomicURL::setPath( const QString &path )
{
    KURL url;
    url.setPath( path );
    if( m_beginning->isEmpty() )
        *this = url;
    else
    {
        m_directory = url.directory();
        m_filename = url.fileName();
    }
}
Esempio n. 28
0
void CollectionDialog::addSong(const KURL &url)
{
  if (currentsl==NULL) return;
  if( url.isEmpty()) return;

  int id=currentsl->AddSong(QFile::encodeName(url.path()));

  if (id==-1)
  {
    printf("Couldn't add song to collection\n");
    return;
  };

  songs->insertItem(url.fileName(),id-1);
}
Esempio n. 29
0
KNFile *KNLoadHelper::getFile(const QString &dialogTitle)
{
    if(f_ile)
        return f_ile;

    KURL url = KFileDialog::getOpenURL(l_astPath, QString::null, p_arent, dialogTitle);

    if(url.isEmpty())
        return 0;

    l_astPath = url.url(-1);
    l_astPath.truncate(l_astPath.length() - url.fileName().length());

    return setURL(url);
}
Esempio n. 30
0
void KImGalleryPlugin::deleteCancelledGallery(const KURL& url, const QString& sourceDirName, int recursionLevel, const QString& imageFormat)
{
    if (m_recurseSubDirectories && (recursionLevel >= 0)) {
        QStringList subDirList;
        QDir toplevel_dir = QDir( sourceDirName );
        toplevel_dir.setFilter( QDir::Dirs );
        subDirList = toplevel_dir.entryList();

        for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end(); it++) {
            if (*it == "." || *it == ".." || *it == "thumbs" || (m_copyFiles && *it == "images")) {
                continue; //disregard the "." and ".." directories
            }
            deleteCancelledGallery( KURL( url.directory() + "/" + *it + "/" + url.fileName() ),
                                    sourceDirName + "/" + *it,
                                    recursionLevel > 1 ? recursionLevel - 1 : 0, imageFormat);
        }
    }

    const QString imgGalleryDir = url.directory();
    QDir thumb_dir( imgGalleryDir + QString::fromLatin1("/thumbs/"));
    QDir images_dir( imgGalleryDir + QString::fromLatin1("/images/"));
    QDir imageDir( sourceDirName, "*.png *.PNG *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.bmp *.BMP",
                   QDir::Name|QDir::IgnoreCase, QDir::Files|QDir::Readable);
    QFile file( url.path() );

    // Remove the image file ..
    file.remove();
    // ..all the thumbnails ..
    for (uint i=0; i < imageDir.count(); i++) {
        const QString imgName = imageDir[i];
        const QString imgNameFormat = imgName + extension(imageFormat);
        bool isRemoved = thumb_dir.remove(imgNameFormat);
        kdDebug(90170) << "removing: " << thumb_dir.path() << "/" << imgNameFormat << "; "<< isRemoved << endl;
    }
    // ..and the thumb directory
    thumb_dir.rmdir(thumb_dir.path());

    // ..and the images directory if images were to be copied
    if (m_copyFiles) {
        for (uint i=0; i < imageDir.count(); i++) {
            const QString imgName = imageDir[i];
            bool isRemoved = images_dir.remove(imgName);
            kdDebug(90170) << "removing: " << images_dir.path() << "/" << imgName << "; "<< isRemoved << endl;
        }
        images_dir.rmdir(images_dir.path());
    }
}