Logo Search packages:      
Sourcecode: karchiver version File versions  Download package

void KarchiveurApp::slotDoDragAndDrop (  )  [slot]

Receive a message when the user try to drag something. It extract the selected files, and then transmit their path to the target application

Definition at line 1198 of file karchiveur.cpp.

References CArchive::extractArchive(), and view.

Referenced by KarchiveurApp().

                                     {
  QListViewItem* vi;
  QStrList urlstotransmitt;
  QString filetoextract;
  QString futuredirectory;
  QString tmp=NULL;
  int k;


  if(operation==NOARCHIVE)
      return;

      //We will extract the archive to a temp folder, so let's clean it
      process->clearArguments();
      *process << "rm" << "-fR" <<tmpdir;
      process->start(KProcess::Block);
      process->clearArguments();
      *process << "mkdir" << tmpdir;
      process->start(KProcess::Block);

      //Extract only the selected files
      archiveobj->extractArchive(tmpdir, EXTRACT_SELECTED_FILES,tmp);

      vi=view->firstChild();
      for(k=0;k<view->childCount();k++)
      {
            if((vi->isSelected())&&(strcmp(vi->text(0),"..")!=0)&&futuredirectory!=vi->text(6))
            {
                  futuredirectory=vi->text(6);
                  filetoextract+=vi->text(6);
                  if(vi->text(6).isEmpty()||vi->text(6)=="/")
                        filetoextract+=vi->text(0);
                  filetoextract=filetoextract.right(filetoextract.length()-1);
                  filetoextract=tmpdir+filetoextract;
                  kdDebug()<<QString("*Drag of:%1*").arg(filetoextract)<<endl;
                  urlstotransmitt.append(filetoextract);
                  filetoextract="";
            }
            vi=vi->nextSibling();
      }
      QDragObject *d = new QUriDrag( urlstotransmitt, this );
      d->dragCopy();
}


Generated by  Doxygen 1.6.0   Back to index