19#include <tqclipboard.h> 
   20#include "konq_operations.h" 
   22#include <kautomount.h> 
   23#include <kinputdialog.h> 
   25#include <tdemessagebox.h> 
   26#include <knotifyclient.h> 
   29#include <tdeshortcut.h> 
   31#include <kdirnotify_stub.h> 
   33#include <dcopclient.h> 
   35#include "konq_defaults.h" 
   36#include "konqbookmarkmanager.h" 
   41#include <tdeapplication.h> 
   44#include <tdefileitem.h> 
   45#include <tdedesktopfile.h> 
   47#include <tdeglobalsettings.h> 
   50#include <tdeio/jobclasses.h> 
   51#include <tdeio/paste.h> 
   52#include <tdeio/netaccess.h> 
   53#include <tdeio/renamedlg.h> 
   55#include <konq_iconviewwidget.h> 
   56#include <kprotocolinfo.h> 
   57#include <tdeprocess.h> 
   58#include <kstringhandler.h> 
   59#include <tqpopupmenu.h> 
   63KBookmarkManager * KonqBookmarkManager::s_bookmarkManager;
 
   65KonqOperations::KonqOperations( TQWidget *parent )
 
   66    : TQObject( parent, 
"KonqOperations" ),
 
   67      m_method( UNKNOWN ), m_info(0L), m_pasteInfo(0L)
 
   71KonqOperations::~KonqOperations()
 
   79  TQString keditfiletype = TQString::fromLatin1(
"keditfiletype");
 
   80  KRun::runCommand( keditfiletype + 
" " + TDEProcess::quote(mimeType),
 
   81                    keditfiletype, keditfiletype );
 
   86  kdDebug(1203) << 
"KonqOperations::del " << parent->className() << endl;
 
   87  if ( selectedURLs.isEmpty() )
 
   89    kdWarning(1203) << 
"Empty URL list !" << endl;
 
   94    ConfirmationType confirmation = DEFAULT_CONFIRMATION;
 
   95  op->_del( method, selectedURLs, confirmation );
 
   98void KonqOperations::emptyTrash()
 
  101  op->_del( EMPTYTRASH, KURL(
"trash:/"), SKIP_CONFIRMATION );
 
  104void KonqOperations::restoreTrashedItems( 
const KURL::List& urls )
 
  107  op->_restoreTrashedItems( urls );
 
  112    TDEIO::Job * job = TDEIO::mkdir( url );
 
  114    op->setOperation( job, MKDIR, KURL::List(), url );
 
  115    (void) 
new KonqCommandRecorder( KonqCommand::MKDIR, KURL(), url, job ); 
 
  120   doPaste(parent, destURL, TQPoint());
 
  127    TQMimeSource *data = TQApplication::clipboard()->data();
 
  128    if ( data->provides( 
"application/x-tde-cutselection" ) ) {
 
  129      move = KonqDrag::decodeIsCutSelection( data );
 
  130      kdDebug(1203) << 
"move (from clipboard data) = " << move << endl;
 
  133    TDEIO::Job *job = TDEIO::pasteClipboard( destURL, move );
 
  137        TDEIO::CopyJob * copyJob = 
static_cast<TDEIO::CopyJob *
>(job);
 
  138        KIOPasteInfo * pi = 
new KIOPasteInfo;
 
  140        op->setPasteInfo( pi );
 
  141        op->setOperation( job, move ? MOVE : COPY, copyJob->srcURLs(), copyJob->destURL() );
 
  142        (void) 
new KonqCommandRecorder( move ? KonqCommand::MOVE : KonqCommand::COPY, KURL::List(), destURL, job );
 
  146void KonqOperations::copy( TQWidget * parent, 
int method, 
const KURL::List & selectedURLs, 
const KURL& destUrl )
 
  148  kdDebug(1203) << 
"KonqOperations::copy() " << parent->className() << endl;
 
  149  if ((method!=COPY) && (method!=MOVE) && (method!=LINK))
 
  151    kdWarning(1203) << 
"Illegal copy method !" << endl;
 
  154  if ( selectedURLs.isEmpty() )
 
  156    kdWarning(1203) << 
"Empty URL list !" << endl;
 
  163     job= TDEIO::link( selectedURLs, destUrl);
 
  164  else if (method==MOVE)
 
  165     job= TDEIO::move( selectedURLs, destUrl);
 
  167     job= TDEIO::copy( selectedURLs, destUrl);
 
  169  op->setOperation( job, method, selectedURLs, destUrl );
 
  172     (void) 
new KonqCommandRecorder( KonqCommand::COPY, selectedURLs, destUrl, job );
 
  174     (
void) 
new KonqCommandRecorder( method==MOVE?KonqCommand::MOVE:KonqCommand::LINK, selectedURLs, destUrl, job );
 
  177void KonqOperations::_del( 
int method, 
const KURL::List & _selectedURLs, ConfirmationType confirmation )
 
  179    KURL::List selectedURLs;
 
  180    for (KURL::List::ConstIterator it = _selectedURLs.begin(); it != _selectedURLs.end(); ++it) {
 
  181        if (KProtocolInfo::supportsDeleting(*it)) {
 
  182            selectedURLs.append(*it);
 
  185    if (selectedURLs.isEmpty()) {
 
  199            job = TDEIO::trash( selectedURLs );
 
  200            (void) 
new KonqCommandRecorder( KonqCommand::TRASH, selectedURLs, 
"trash:/", job );
 
  206            TQByteArray packedArgs;
 
  207            TQDataStream stream( packedArgs, IO_WriteOnly );
 
  209            job = TDEIO::special( 
"trash:/", packedArgs );
 
  210            KNotifyClient::event(0, 
"Trash: emptied");
 
  214            job = TDEIO::del( selectedURLs );
 
  217            job = TDEIO::del( selectedURLs, 
true );
 
  220            kdWarning() << 
"Unknown operation: " << method << endl;
 
  224        connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ),
 
  225                 TQ_SLOT( slotResult( TDEIO::Job * ) ) );
 
  230void KonqOperations::_restoreTrashedItems( 
const KURL::List& urls )
 
  234    connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ),
 
  235             TQ_SLOT( slotResult( TDEIO::Job * ) ) );
 
  240    if ( confirmation == SKIP_CONFIRMATION )
 
  243    bool ask = ( confirmation == FORCE_CONFIRMATION );
 
  246        TDEConfig config(
"konquerorrc", 
true, 
false);
 
  247        config.setGroup( 
"Trash" );
 
  248        keyName = ( method == DEL ? 
"ConfirmDelete" : method == SHRED ? 
"ConfirmShred" : 
"ConfirmTrash" );
 
  249        bool defaultValue = ( method == DEL ? DEFAULT_CONFIRMDELETE : method == SHRED ? DEFAULT_CONFIRMSHRED : DEFAULT_CONFIRMTRASH );
 
  250        ask = config.readBoolEntry( keyName, defaultValue );
 
  254      KURL::List::ConstIterator it = selectedURLs.begin();
 
  255      TQStringList prettyList;
 
  256      for ( ; it != selectedURLs.end(); ++it ) {
 
  257        if ( (*it).protocol() == 
"trash" ) {
 
  258          TQString path = (*it).path();
 
  261          prettyList.append( path.remove(TQRegExp(
"^/[0-9]*-")) );
 
  263          prettyList.append( (*it).pathOrURL() );
 
  270          result = KMessageBox::warningContinueCancelList( widget,
 
  271                i18n( 
"Do you really want to delete this item?", 
"Do you really want to delete these %n items?", prettyList.count()),
 
  273        i18n( 
"Delete Files" ),
 
  275        keyName, KMessageBox::Dangerous);
 
  279          result = KMessageBox::warningContinueCancelList( widget,
 
  280                i18n( 
"Do you really want to shred this item?", 
"Do you really want to shred these %n items?", prettyList.count()),
 
  282                i18n( 
"Shred Files" ),
 
  283        KGuiItem( i18n( 
"Shred" ), 
"editshred" ),
 
  284        keyName, KMessageBox::Dangerous);
 
  289          result = KMessageBox::warningContinueCancelList( widget,
 
  290                i18n( 
"Do you really want to move this item to the trash?", 
"Do you really want to move these %n items to the trash?", prettyList.count()),
 
  292        i18n( 
"Move to Trash" ),
 
  293        KGuiItem( i18n( 
"Verb", 
"&Trash" ), 
"edittrash"),
 
  294        keyName, KMessageBox::Dangerous);
 
  296      if (!keyName.isEmpty())
 
  299         TDEConfig *config = tdeApp->config();
 
  300         TDEConfigGroupSaver saver(config, 
"Notification Messages");
 
  301         if (!config->readBoolEntry(keyName, 
true))
 
  303            config->writeEntry(keyName, 
true);
 
  305            TDEConfig konq_config(
"konquerorrc", 
false);
 
  306            konq_config.setGroup( 
"Trash" );
 
  307            konq_config.writeEntry( keyName, 
false );
 
  310      return (result == KMessageBox::Continue);
 
  317    kdDebug(1203) << 
"doDrop: dest : " << dest.url() << endl;
 
  319    TQMap<TQString, TQString> metaData;
 
  320    if ( KURLDrag::decode( ev, lst, metaData ) ) 
 
  322        if( lst.count() == 0 )
 
  324            kdWarning(1203) << 
"Oooops, no data ...." << endl;
 
  328        kdDebug(1203) << 
"KonqOperations::doDrop metaData: " << metaData.count() << 
" entries." << endl;
 
  329        TQMap<TQString,TQString>::ConstIterator mit;
 
  330        for( mit = metaData.begin(); mit != metaData.end(); ++mit )
 
  332            kdDebug(1203) << 
"metaData: key=" << mit.key() << 
" value=" << mit.data() << endl;
 
  335        KURL::List::Iterator it = lst.begin();
 
  336        for ( ; it != lst.end() ; it++ )
 
  338            kdDebug(1203) << 
"URL : " << (*it).url() << endl;
 
  339            if ( dest.equals( *it, 
true  ) )
 
  343                if ( !ev->source() || ev->source() != parent && ev->source()->parent() != parent )
 
  344                    KMessageBox::sorry( parent, i18n(
"You cannot drop a folder on to itself") );
 
  345                kdDebug(1203) << 
"Dropped on itself" << endl;
 
  354        int root_x, root_y, win_x, win_y;
 
  356        XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child,
 
  357                       &root_x, &root_y, &win_x, &win_y, &keybstate );
 
  359        TQDropEvent::Action action = ev->action();
 
  361        if ( ev->provides(
"application/x-xbel") )
 
  363            keybstate |= ControlMask | ShiftMask;
 
  364            action = TQDropEvent::Link;
 
  365            kdDebug(1203) << 
"KonqOperations::doDrop Bookmark -> emulating Link" << endl;
 
  369        op->setDropInfo( 
new DropInfo( keybstate, lst, metaData, win_x, win_y, action ) );
 
  374            op->asyncDrop( destItem ); 
 
  379            op->_statURL( dest, op, TQ_SLOT( asyncDrop( 
const KFileItem * ) ) );
 
  389        TDEIO::CopyJob* job = TDEIO::pasteMimeSource( ev, dest,
 
  390                                                  i18n( 
"File name for dropped contents:" ),
 
  394            op->setOperation( job, COPY, KURL::List(), job->destURL() );
 
  395            (void) 
new KonqCommandRecorder( KonqCommand::COPY, KURL::List(), dest, job );
 
  401void KonqOperations::asyncDrop( 
const KFileItem * destItem )
 
  404    m_destURL = destItem->url();
 
  408    if ( destItem->isDir() )
 
  413    if ( !m_destURL.isLocalFile() )
 
  418        kdWarning(1203) << 
"Cannot drop onto " << m_destURL << endl;
 
  422    if ( (destItem->mimetype() == 
"application/x-desktop")
 
  423      || (destItem->mimetype() == 
"media/builtin-mydocuments")
 
  424      || (destItem->mimetype() == 
"media/builtin-mycomputer")
 
  425      || (destItem->mimetype() == 
"media/builtin-mynetworkplaces")
 
  426      || (destItem->mimetype() == 
"media/builtin-printers")
 
  427      || (destItem->mimetype() == 
"media/builtin-trash")
 
  428      || (destItem->mimetype() == 
"media/builtin-webbrowser") )
 
  431        TDEDesktopFile desktopFile( m_destURL.path() );
 
  432        if ( desktopFile.hasApplicationType() )
 
  435            TQStringList stringList;
 
  436            KURL::List lst = m_info->lst;
 
  437            KURL::List::Iterator it = lst.begin();
 
  438            for ( ; it != lst.end() ; it++ )
 
  440                stringList.append((*it).url());
 
  442            if ( TDEApplication::startServiceByDesktopPath( m_destURL.path(), stringList, &error ) > 0 )
 
  443                KMessageBox::error( 0L, error );
 
  448            if ( desktopFile.hasDeviceType() && desktopFile.hasKey(
"MountPoint") ) {
 
  449                TQString point = desktopFile.readEntry( 
"MountPoint" );
 
  450                m_destURL.setPath( point );
 
  451                TQString dev = desktopFile.readDevice();
 
  452                TQString mp = TDEIO::findDeviceMountPoint( dev );
 
  458                    bool ro = desktopFile.readBoolEntry( 
"ReadOnly", 
false );
 
  459                    TQString fstype = desktopFile.readEntry( 
"FSType" );
 
  460                    KAutoMount* am = 
new KAutoMount( ro, fstype, dev, point, m_destURL.path(), 
false );
 
  461                    connect( am, TQ_SIGNAL( finished() ), 
this, TQ_SLOT( doFileCopy() ) );
 
  465            else if ( desktopFile.hasLinkType() && desktopFile.hasKey(
"URL") ) {
 
  466                m_destURL = desktopFile.readPathEntry(
"URL");
 
  477        kdDebug(1203) << 
"KonqOperations::doDrop " << m_destURL.path() << 
"should be an executable" << endl;
 
  478        Q_ASSERT ( access( TQFile::encodeName(m_destURL.path()), X_OK ) == 0 );
 
  480        proc << m_destURL.path() ;
 
  482        KURL::List lst = m_info->lst;
 
  483        KURL::List::Iterator it = lst.begin();
 
  484        for ( ; it != lst.end() ; it++ )
 
  485            proc << (*it).path(); 
 
  486        kdDebug(1203) << 
"starting " << m_destURL.path() << 
" with " << lst.count() << 
" arguments" << endl;
 
  487        proc.start( TDEProcess::DontCare );
 
  492void KonqOperations::doFileCopy()
 
  495    KURL::List lst = m_info->lst;
 
  496    TQDropEvent::Action action = m_info->action;
 
  497    bool isDesktopFile = 
false;
 
  498    bool itemIsOnDesktop = 
false;
 
  499    bool allItemsAreFromTrash = 
true;
 
  501    for (KURL::List::ConstIterator it = lst.begin(); it != lst.end(); ++it)
 
  503        bool local = (*it).isLocalFile();
 
  504        if ( KProtocolInfo::supportsDeleting( *it ) && (!local || TQFileInfo((*it).directory()).isWritable() ))
 
  506        if ( local && TDEDesktopFile::isDesktopFile((*it).path()))
 
  507            isDesktopFile = 
true;
 
  508        if ( local && (*it).path().startsWith(TDEGlobalSettings::desktopPath()))
 
  509            itemIsOnDesktop = 
true;
 
  510        if ( local || (*it).protocol() != 
"trash" )
 
  511            allItemsAreFromTrash = 
false;
 
  514    bool linkOnly = 
false;
 
  515    if (isDesktopFile && !tdeApp->authorize(
"run_desktop_files") &&
 
  516        (m_destURL.path(1) == TDEGlobalSettings::desktopPath()) )
 
  521    if ( !mlst.isEmpty() && m_destURL.protocol() == 
"trash" )
 
  523        if ( itemIsOnDesktop && !tdeApp->authorize(
"editable_desktop_icons") )
 
  531            action = TQDropEvent::Move;
 
  538    else if ( allItemsAreFromTrash || m_destURL.protocol() == 
"trash" ) {
 
  540        action = TQDropEvent::Move;
 
  542    else if ( (((m_info->keybstate & ControlMask) == 0) && ((m_info->keybstate & ShiftMask) == 0)) ||
 
  547        bool bSetWallpaper = 
false;
 
  548        if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 )
 
  550            KURL url = lst.first();
 
  551            KMimeType::Ptr mime = KMimeType::findByURL( url );
 
  552            if ( ( !KImageIO::type(url.path()).isEmpty() ) ||
 
  553                 ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) ||
 
  554                 mime->is( 
"image/svg+xml" ) )
 
  556                bSetWallpaper = 
true;
 
  561        KURL url = lst.first(); 
 
  562        bool sReading = KProtocolInfo::supportsReading( url );
 
  563        bool sDeleting = KProtocolInfo::supportsDeleting( url );
 
  564        bool sMoving = KProtocolInfo::supportsMoving( url );
 
  566        bool dWriting = KProtocolInfo::supportsWriting( m_destURL );
 
  574        if (!mlst.isEmpty() && (sMoving || (sReading && sDeleting)) && !linkOnly )
 
  575            popup.insertItem(SmallIconSet(
"goto"), i18n( 
"&Move Here" ) + 
"\t" + KKey::modFlagLabel( KKey::SHIFT ), 2 );
 
  576        if ( sReading && !linkOnly)
 
  577            popup.insertItem(SmallIconSet(
"edit-copy"), i18n( 
"&Copy Here" ) + 
"\t" + KKey::modFlagLabel( KKey::CTRL ), 1 );
 
  578        popup.insertItem(SmallIconSet(
"www"), i18n( 
"&Link Here" ) + 
"\t" + KKey::modFlagLabel( (KKey::ModFlag)( KKey::CTRL|KKey::SHIFT ) ), 3 );
 
  580            popup.insertItem(SmallIconSet(
"background"), i18n( 
"Set as &Wallpaper" ), 4 );
 
  581        popup.insertSeparator();
 
  582        popup.insertItem(SmallIconSet(
"cancel"), i18n( 
"C&ancel" ) + 
"\t" + KKey( TQt::Key_Escape ).toString(), 5);
 
  584        int result = popup.exec( m_info->mousePos );
 
  587        case 1 : action = TQDropEvent::Copy; 
break;
 
  588        case 2 : action = TQDropEvent::Move; 
break;
 
  589        case 3 : action = TQDropEvent::Link; 
break;
 
  592            kdDebug(1203) << 
"setWallpaper iconView=" << iconView << 
" url=" << lst.first().url() << endl;
 
  593            if (iconView && iconView->isDesktop() ) iconView->
setWallpaper(lst.first());
 
  598        default : 
delete this; 
return;
 
  602    TDEIO::Job * job = 0;
 
  604    case TQDropEvent::Move :
 
  605        job = TDEIO::move( lst, m_destURL );
 
  606        job->setMetaData( m_info->metaData );
 
  607        setOperation( job, m_method == TRASH ? TRASH : MOVE, lst, m_destURL );
 
  608        (void) 
new KonqCommandRecorder(
 
  609            m_method == TRASH ? KonqCommand::TRASH : KonqCommand::MOVE,
 
  610            lst, m_destURL, job );
 
  612    case TQDropEvent::Copy :
 
  613        job = TDEIO::copy( lst, m_destURL );
 
  614        job->setMetaData( m_info->metaData );
 
  615        setOperation( job, COPY, lst, m_destURL );
 
  616        (void) 
new KonqCommandRecorder( KonqCommand::COPY, lst, m_destURL, job );
 
  618    case TQDropEvent::Link :
 
  619        kdDebug(1203) << 
"KonqOperations::asyncDrop lst.count=" << lst.count() << endl;
 
  620        job = TDEIO::link( lst, m_destURL );
 
  621        job->setMetaData( m_info->metaData );
 
  622        setOperation( job, LINK, lst, m_destURL );
 
  623        (void) 
new KonqCommandRecorder( KonqCommand::LINK, lst, m_destURL, job );
 
  625    default : kdError(1203) << 
"Unknown action " << (int)action << endl;
 
  632    kdDebug(1203) << 
"KonqOperations::rename oldurl=" << oldurl << 
" newurl=" << newurl << endl;
 
  633    if ( oldurl == newurl )
 
  638    TDEIO::Job * job = TDEIO::moveAs( oldurl, newurl, !oldurl.isLocalFile() );
 
  640    op->setOperation( job, MOVE, lst, newurl );
 
  641    (void) 
new KonqCommandRecorder( KonqCommand::MOVE, lst, newurl, job );
 
  643    if ( oldurl.isLocalFile() && oldurl.path(1) == TDEGlobalSettings::desktopPath() )
 
  645        kdDebug(1203) << 
"That rename was the Desktop path, updating config files" << endl;
 
  646        TDEConfig *globalConfig = TDEGlobal::config();
 
  647        TDEConfigGroupSaver cgs( globalConfig, 
"Paths" );
 
  648        globalConfig->writePathEntry(
"Desktop" , newurl.path(), 
true, 
true );
 
  649        globalConfig->sync();
 
  650        KIPC::sendMessageAll(KIPC::SettingsChanged, TDEApplication::SETTINGS_PATHS);
 
  654void KonqOperations::setOperation( TDEIO::Job * job, 
int method, 
const KURL::List & , 
const KURL & dest )
 
  661        connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ),
 
  662                 TQ_SLOT( slotResult( TDEIO::Job * ) ) );
 
  663        TDEIO::CopyJob *copyJob = 
dynamic_cast<TDEIO::CopyJob*
>(job);
 
  665        if (copyJob && iconView)
 
  667            connect(copyJob, TQ_SIGNAL(aboutToCreate(TDEIO::Job *,
const TQValueList<TDEIO::CopyInfo> &)),
 
  668                 this, TQ_SLOT(slotAboutToCreate(TDEIO::Job *,
const TQValueList<TDEIO::CopyInfo> &)));
 
  669            connect(
this, TQ_SIGNAL(aboutToCreate(
const TQPoint &, 
const TQValueList<TDEIO::CopyInfo> &)),
 
  670                 iconView, TQ_SLOT(slotAboutToCreate(
const TQPoint &, 
const TQValueList<TDEIO::CopyInfo> &)));
 
  677void KonqOperations::slotAboutToCreate(TDEIO::Job *, 
const TQValueList<TDEIO::CopyInfo> &files)
 
  679    emit aboutToCreate( m_info ? m_info->mousePos : m_pasteInfo ? m_pasteInfo->mousePos : TQPoint(), files);
 
  685    op->_statURL( url, receiver, member );
 
  689void KonqOperations::_statURL( 
const KURL & url, 
const TQObject *receiver, 
const char *member )
 
  691    connect( 
this, TQ_SIGNAL( statFinished( 
const KFileItem * ) ), receiver, member );
 
  692    TDEIO::StatJob * job = TDEIO::stat( url  );
 
  693    connect( job, TQ_SIGNAL( result( TDEIO::Job * ) ),
 
  694             TQ_SLOT( slotStatResult( TDEIO::Job * ) ) );
 
  697void KonqOperations::slotStatResult( TDEIO::Job * job )
 
  700        job->showErrorDialog( (TQWidget*)parent() );
 
  703        TDEIO::StatJob * statJob = 
static_cast<TDEIO::StatJob*
>(job);
 
  704        KFileItem * item = 
new KFileItem( statJob->statResult(), statJob->url() );
 
  705        emit statFinished( item );
 
  709    if ( m_method == STAT )
 
  713void KonqOperations::slotResult( TDEIO::Job * job )
 
  715    if (job && job->error())
 
  716        job->showErrorDialog( (TQWidget*)parent() );
 
  717    if ( m_method == EMPTYTRASH ) {
 
  719        KDirNotify_stub allDirNotify(
"*", 
"KDirNotify*");
 
  720        allDirNotify.FilesAdded( 
"trash:/" ); 
 
  727    KURL newurl( oldurl );
 
  728    newurl.setPath( oldurl.directory(
false, 
true) + name );
 
  729    kdDebug(1203) << 
"KonqOperations::rename("<<name<<
") called. newurl=" << newurl << endl;
 
  730    rename( parent, oldurl, newurl );
 
  736    TQString name = i18n( 
"New Folder" );
 
  737    if ( baseURL.isLocalFile() && TQFileInfo( baseURL.path(+1) + name ).exists() )
 
  738        name = TDEIO::RenameDlg::suggestName( baseURL, i18n( 
"New Folder" ) );
 
  740    name = KInputDialog::getText ( i18n( 
"New Folder" ),
 
  741        i18n( 
"Enter folder name:" ), name, &ok, parent );
 
  742    if ( ok && !name.isEmpty() )
 
  745        if ((name[0] == 
'/') || (name[0] == 
'~'))
 
  747           url.setPath(KShell::tildeExpand(name));
 
  751           name = TDEIO::encodeFileName( name );
 
  761KonqMultiRestoreJob::KonqMultiRestoreJob( 
const KURL::List& urls, 
bool showProgressInfo )
 
  762    : TDEIO::Job( showProgressInfo ),
 
  763      m_urls( urls ), m_urlsIterator( m_urls.begin() ),
 
  766  TQTimer::singleShot(0, 
this, TQ_SLOT(slotStart()));
 
  769void KonqMultiRestoreJob::slotStart()
 
  775    if ( m_urlsIterator != m_urls.end() )
 
  777        const KURL& url = *m_urlsIterator;
 
  780        if ( new_url.protocol()==
"system" 
  781          && new_url.path().startsWith(
"/trash") )
 
  783            TQString path = new_url.path();
 
  785        new_url.setProtocol(
"trash");
 
  786        new_url.setPath(path);
 
  789        Q_ASSERT( new_url.protocol() == 
"trash" );
 
  790        TQByteArray packedArgs;
 
  791        TQDataStream stream( packedArgs, IO_WriteOnly );
 
  792        stream << (int)3 << new_url;
 
  793        TDEIO::Job* job = TDEIO::special( new_url, packedArgs );
 
  798        KDirNotify_stub allDirNotify(
"*", 
"KDirNotify*");
 
  799        allDirNotify.FilesRemoved( m_urls );
 
  804void KonqMultiRestoreJob::slotResult( TDEIO::Job *job )
 
  808        TDEIO::Job::slotResult( job ); 
 
  811    subjobs.remove( job );
 
  816    emitPercent( m_progress, m_urls.count() );
 
  820TQWidget* KonqOperations::parentWidget()
 const 
  822    return static_cast<TQWidget *
>( parent() );
 
  825#include "konq_operations.moc" 
Restore multiple trashed files.
 
Implements file operations (move,del,trash,shred,paste,copy,move,link...) for konqueror and kdesktop ...
 
static void doPaste(TQWidget *parent, const KURL &destURL, const TQPoint &pos)
Paste the clipboard contents.
 
static void statURL(const KURL &url, const TQObject *receiver, const char *member)
Get info about a given URL, and when that's done (it's asynchronous!), call a given slot with the KFi...
 
static void rename(TQWidget *parent, const KURL &oldurl, const TQString &name)
Do a renaming.
 
static void del(TQWidget *parent, int method, const KURL::List &selectedURLs)
Delete the selectedURLs if possible.
 
static void newDir(TQWidget *parent, const KURL &baseURL)
Ask for the name of a new directory and create it.
 
static void editMimeType(const TQString &mimeType)
Pop up properties dialog for mimetype mimeType.
 
static void mkdir(TQWidget *parent, const KURL &url)
Create a directory.
 
static bool askDeleteConfirmation(const KURL::List &selectedURLs, int method, ConfirmationType confirmation, TQWidget *widget)
Ask for confirmation before deleting/trashing selectedURLs.
 
static void copy(TQWidget *parent, int method, const KURL::List &selectedURLs, const KURL &destURL)
Copy the selectedURLs to the destination destURL.
 
static void doDrop(const KFileItem *destItem, const KURL &destURL, TQDropEvent *ev, TQWidget *parent)
Drop.