void MyClass::CopyMarked(bool move)
{
// m_currDir = "/tmp";
if (m_markedList.isEmpty())
return;
tr("Moving marked files...") : tr("Copying marked files...");
//.....
// Here a seelctor dialog appears to choose the destination
//......
if(selector.
exec() == QDialog::Accepted){ QUrlOperator* copyOperator = new QUrlOperator;
int size = 0;
//m_markedList contains the names of the files to be copied or moved
for (unsigned int i = 0; i < m_markedList.count() ; i++)
{
QFile file(*m_markedList.
at(i
));
size += file.size();
}
m_copyProgress = new MythProgressDialog(msg, size);
connect(copyOperator,SIGNAL(dataTransferProgress(int,int,QNetworkOperation*)),
this,SLOT(dataTransferProgress(int,int,QNetworkOperation*)));
connect(copyOperator,SIGNAL(finished(QNetworkOperation*)),
this,SLOT(finished(QNetworkOperation*)));
copyOperator->copy(m_markedList,selector.getSelected(),move);
}
}
void MyClass::dataTransferProgress(int bytesDone, int, QNetworkOperation*)
{
m_copyProgress->setProgress(bytesDone);
}
void MyClass::finished(QNetworkOperation*)
{
m_copyProgress->close();
}
void MyClass::CopyMarked(bool move)
{
// m_currDir = "/tmp";
if (m_markedList.isEmpty())
return;
QString msg = (move) ?
tr("Moving marked files...") : tr("Copying marked files...");
//.....
// Here a seelctor dialog appears to choose the destination
//......
if(selector.exec() == QDialog::Accepted){
QUrlOperator* copyOperator = new QUrlOperator;
int size = 0;
QString msg;
//m_markedList contains the names of the files to be copied or moved
for (unsigned int i = 0; i < m_markedList.count() ; i++)
{
QFile file(*m_markedList.at(i));
size += file.size();
}
m_copyProgress = new MythProgressDialog(msg, size);
connect(copyOperator,SIGNAL(dataTransferProgress(int,int,QNetworkOperation*)),
this,SLOT(dataTransferProgress(int,int,QNetworkOperation*)));
connect(copyOperator,SIGNAL(finished(QNetworkOperation*)),
this,SLOT(finished(QNetworkOperation*)));
copyOperator->copy(m_markedList,selector.getSelected(),move);
}
}
void MyClass::dataTransferProgress(int bytesDone, int, QNetworkOperation*)
{
m_copyProgress->setProgress(bytesDone);
}
void MyClass::finished(QNetworkOperation*)
{
m_copyProgress->close();
}
To copy to clipboard, switch view to plain text mode
Bookmarks