thelinuxer
2nd August 2007, 13:12
Hi Everyone,
I have been trying to use QUrlOperator to copy some files from one loaction to another. The strange thing is that I keep on receiving dataTransferProgress signal and the progress bar advances but no file is created and everything goes normal untill I get a finished signal but nothing is copied. After waiting for some more time I found out that I keep on receiving dataTransferProgress signal and then a finished signal and this time the file is copied! This second time gets started without any interaction from me.
I am using Qt 3.3.7 under Linux Kubuntu feisty.
Here is my code:
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(i nt,int,QNetworkOperation*)),
this,SLOT(dataTransferProgress(int,int,QNetworkOpe ration*)));
connect(copyOperator,SIGNAL(finished(QNetworkOpera tion*)),
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();
}
Thanx in advance,
Ahmed Toulan.
I have been trying to use QUrlOperator to copy some files from one loaction to another. The strange thing is that I keep on receiving dataTransferProgress signal and the progress bar advances but no file is created and everything goes normal untill I get a finished signal but nothing is copied. After waiting for some more time I found out that I keep on receiving dataTransferProgress signal and then a finished signal and this time the file is copied! This second time gets started without any interaction from me.
I am using Qt 3.3.7 under Linux Kubuntu feisty.
Here is my code:
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(i nt,int,QNetworkOperation*)),
this,SLOT(dataTransferProgress(int,int,QNetworkOpe ration*)));
connect(copyOperator,SIGNAL(finished(QNetworkOpera tion*)),
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();
}
Thanx in advance,
Ahmed Toulan.