|
|
|
@ -14,7 +14,7 @@
|
|
|
|
|
#include <kio/global.h>
|
|
|
|
|
#include <kmessagebox.h>
|
|
|
|
|
#include "optiondialog.h"
|
|
|
|
|
#include <layout.h>
|
|
|
|
|
#include <tqlayout.h>
|
|
|
|
|
#include <tqlabel.h>
|
|
|
|
|
#include <tqapplication.h>
|
|
|
|
|
#include <tqpushbutton.h>
|
|
|
|
@ -25,7 +25,7 @@
|
|
|
|
|
#include <ktempfile.h>
|
|
|
|
|
#include <tqdir.h>
|
|
|
|
|
#include <tqregexp.h>
|
|
|
|
|
#include <textstream.h>
|
|
|
|
|
#include <tqtextstream.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <klocale.h>
|
|
|
|
|
|
|
|
|
@ -407,11 +407,11 @@ bool FileAccess::writeFile( const void* pSrcBuffer, unsigned long length )
|
|
|
|
|
if ( isExecutable() ) // value is true if the old file was executable
|
|
|
|
|
{
|
|
|
|
|
// Preserve attributes
|
|
|
|
|
struct stat srcFileStatus;
|
|
|
|
|
int statResult = ::stat( filePath().ascii(), &srcFileStatus );
|
|
|
|
|
struct stat srcFiletqStatus;
|
|
|
|
|
int statResult = ::stat( filePath().ascii(), &srcFiletqStatus );
|
|
|
|
|
if (statResult==0)
|
|
|
|
|
{
|
|
|
|
|
::chmod ( filePath().ascii(), srcFileStatus.st_mode | S_IXUSR );
|
|
|
|
|
::chmod ( filePath().ascii(), srcFiletqStatus.st_mode | S_IXUSR );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -625,7 +625,7 @@ bool FileAccessJobHandler::stat( int detail, bool bWantToWrite )
|
|
|
|
|
|
|
|
|
|
connect( pStatJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotStatResult(KIO::Job*)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pStatJob, i18n("Getting file status: %1").arg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pStatJob, i18n("Getting file status: %1").tqarg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
@ -668,7 +668,7 @@ bool FileAccessJobHandler::get(void* pDestBuffer, long maxLength )
|
|
|
|
|
connect( pJob, TQT_SIGNAL(data(KIO::Job*,const TQByteArray &)), this, TQT_SLOT(slotGetData(KIO::Job*, const TQByteArray&)));
|
|
|
|
|
connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Reading file: %1").arg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Reading file: %1").tqarg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -704,7 +704,7 @@ bool FileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOve
|
|
|
|
|
connect( pJob, TQT_SIGNAL(dataReq(KIO::Job*, TQByteArray&)), this, TQT_SLOT(slotPutData(KIO::Job*, TQByteArray&)));
|
|
|
|
|
connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Writing file: %1").arg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Writing file: %1").tqarg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -721,7 +721,7 @@ void FileAccessJobHandler::slotPutData( KIO::Job* pJob, TQByteArray& data )
|
|
|
|
|
{
|
|
|
|
|
long maxChunkSize = 100000;
|
|
|
|
|
long length = min2( maxChunkSize, m_maxLength - m_transferredBytes );
|
|
|
|
|
bool bSuccess = data.resize( length );
|
|
|
|
|
bool bSuccess = data.tqresize( length );
|
|
|
|
|
if ( bSuccess )
|
|
|
|
|
{
|
|
|
|
|
if ( length>0 )
|
|
|
|
@ -767,7 +767,7 @@ bool FileAccessJobHandler::mkDir( const TQString& dirName )
|
|
|
|
|
KIO::SimpleJob* pJob = KIO::mkdir( dirURL );
|
|
|
|
|
connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Making directory: %1").arg(dirName) );
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Making directory: %1").tqarg(dirName) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -787,7 +787,7 @@ bool FileAccessJobHandler::rmDir( const TQString& dirName )
|
|
|
|
|
KIO::SimpleJob* pJob = KIO::rmdir( dirURL );
|
|
|
|
|
connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop(pJob, i18n("Removing directory: %1").arg(dirName));
|
|
|
|
|
g_pProgressDialog->enterEventLoop(pJob, i18n("Removing directory: %1").tqarg(dirName));
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -802,7 +802,7 @@ bool FileAccessJobHandler::removeFile( const TQString& fileName )
|
|
|
|
|
KIO::SimpleJob* pJob = KIO::file_delete( KURL::fromPathOrURL(fileName), false );
|
|
|
|
|
connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Removing file: %1").arg(fileName) );
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob, i18n("Removing file: %1").tqarg(fileName) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -818,7 +818,7 @@ bool FileAccessJobHandler::symLink( const TQString& linkTarget, const TQString&
|
|
|
|
|
connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob,
|
|
|
|
|
i18n("Creating symbolic link: %1 -> %2").arg(linkLocation).arg(linkTarget) );
|
|
|
|
|
i18n("Creating symbolic link: %1 -> %2").tqarg(linkLocation).tqarg(linkTarget) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -848,7 +848,7 @@ bool FileAccessJobHandler::rename( const TQString& dest )
|
|
|
|
|
connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob,
|
|
|
|
|
i18n("Renaming file: %1 -> %2").arg(m_pFileAccess->prettyAbsPath()).arg(dest) );
|
|
|
|
|
i18n("Renaming file: %1 -> %2").tqarg(m_pFileAccess->prettyAbsPath()).tqarg(dest) );
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -884,7 +884,7 @@ bool FileAccessJobHandler::copyFile( const TQString& dest )
|
|
|
|
|
connect( pJob, TQT_SIGNAL(result(KIO::Job*)), this, TQT_SLOT(slotSimpleJobResult(KIO::Job*)));
|
|
|
|
|
connect( pJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long)));
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pJob,
|
|
|
|
|
i18n("Copying file: %1 -> %2").arg(m_pFileAccess->prettyAbsPath()).arg(dest) );
|
|
|
|
|
i18n("Copying file: %1 -> %2").tqarg(m_pFileAccess->prettyAbsPath()).tqarg(dest) );
|
|
|
|
|
|
|
|
|
|
return m_bSuccess;
|
|
|
|
|
// Note that the KIO-slave preserves the original date, if this is supported.
|
|
|
|
@ -898,13 +898,13 @@ bool FileAccessJobHandler::copyFile( const TQString& dest )
|
|
|
|
|
bool bReadSuccess = srcFile.open( IO_ReadOnly );
|
|
|
|
|
if ( bReadSuccess == false )
|
|
|
|
|
{
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for reading failed. Filename: %1").arg(srcName);
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for reading failed. Filename: %1").tqarg(srcName);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool bWriteSuccess = destFile.open( IO_WriteOnly );
|
|
|
|
|
if ( bWriteSuccess == false )
|
|
|
|
|
{
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for writing failed. Filename: %1").arg(destName);
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Opening file for writing failed. Filename: %1").tqarg(destName);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -916,7 +916,7 @@ bool FileAccessJobHandler::copyFile( const TQString& dest )
|
|
|
|
|
TQ_LONG readSize = srcFile.readBlock( &buffer[0], min2( srcSize, bufSize ) );
|
|
|
|
|
if ( readSize==-1 || readSize==0 )
|
|
|
|
|
{
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Reading failed. Filename: %1").arg(srcName);
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Reading failed. Filename: %1").tqarg(srcName);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
srcSize -= readSize;
|
|
|
|
@ -925,7 +925,7 @@ bool FileAccessJobHandler::copyFile( const TQString& dest )
|
|
|
|
|
TQ_LONG writeSize = destFile.writeBlock( &buffer[0], readSize );
|
|
|
|
|
if ( writeSize==-1 || writeSize==0 )
|
|
|
|
|
{
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Writing failed. Filename: %1").arg(destName);
|
|
|
|
|
m_pFileAccess->m_statusText = i18n("Error during file copy operation: Writing failed. Filename: %1").tqarg(destName);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
readSize -= writeSize;
|
|
|
|
@ -938,28 +938,28 @@ bool FileAccessJobHandler::copyFile( const TQString& dest )
|
|
|
|
|
|
|
|
|
|
// Update the times of the destFile
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
struct _stat srcFileStatus;
|
|
|
|
|
int statResult = ::_stat( srcName.ascii(), &srcFileStatus );
|
|
|
|
|
struct _stat srcFiletqStatus;
|
|
|
|
|
int statResult = ::_stat( srcName.ascii(), &srcFiletqStatus );
|
|
|
|
|
if (statResult==0)
|
|
|
|
|
{
|
|
|
|
|
_utimbuf destTimes;
|
|
|
|
|
destTimes.actime = srcFileStatus.st_atime;/* time of last access */
|
|
|
|
|
destTimes.modtime = srcFileStatus.st_mtime;/* time of last modification */
|
|
|
|
|
destTimes.actime = srcFiletqStatus.st_atime;/* time of last access */
|
|
|
|
|
destTimes.modtime = srcFiletqStatus.st_mtime;/* time of last modification */
|
|
|
|
|
|
|
|
|
|
_utime ( destName.ascii(), &destTimes );
|
|
|
|
|
_chmod ( destName.ascii(), srcFileStatus.st_mode );
|
|
|
|
|
_chmod ( destName.ascii(), srcFiletqStatus.st_mode );
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
struct stat srcFileStatus;
|
|
|
|
|
int statResult = ::stat( srcName.ascii(), &srcFileStatus );
|
|
|
|
|
struct stat srcFiletqStatus;
|
|
|
|
|
int statResult = ::stat( srcName.ascii(), &srcFiletqStatus );
|
|
|
|
|
if (statResult==0)
|
|
|
|
|
{
|
|
|
|
|
utimbuf destTimes;
|
|
|
|
|
destTimes.actime = srcFileStatus.st_atime;/* time of last access */
|
|
|
|
|
destTimes.modtime = srcFileStatus.st_mtime;/* time of last modification */
|
|
|
|
|
destTimes.actime = srcFiletqStatus.st_atime;/* time of last access */
|
|
|
|
|
destTimes.modtime = srcFiletqStatus.st_mtime;/* time of last modification */
|
|
|
|
|
|
|
|
|
|
utime ( destName.ascii(), &destTimes );
|
|
|
|
|
chmod ( destName.ascii(), srcFileStatus.st_mode );
|
|
|
|
|
chmod ( destName.ascii(), srcFiletqStatus.st_mode );
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return true;
|
|
|
|
@ -1010,7 +1010,7 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore )
|
|
|
|
|
".nse_depinfo #* .#* cvslog.* ,* CVS CVS.adm .del-* *.a *.olb *.o *.obj "
|
|
|
|
|
"*.so *.Z *~ *.old *.elc *.ln *.bak *.BAK *.orig *.rej *.exe _$* *$";
|
|
|
|
|
|
|
|
|
|
addEntriesFromString(TQString::fromLatin1(ignorestr));
|
|
|
|
|
addEntriesFromString(TQString::tqfromLatin1(ignorestr));
|
|
|
|
|
addEntriesFromFile(TQDir::homeDirPath() + "/.cvsignore");
|
|
|
|
|
addEntriesFromString(TQString::fromLocal8Bit(::getenv("CVSIGNORE")));
|
|
|
|
|
|
|
|
|
@ -1032,7 +1032,7 @@ void CvsIgnoreList::init( FileAccess& dir, bool bUseLocalCvsIgnore )
|
|
|
|
|
{
|
|
|
|
|
if (pos>pos1)
|
|
|
|
|
{
|
|
|
|
|
addEntry( TQString::fromLatin1( &buf[pos1], pos-pos1 ) );
|
|
|
|
|
addEntry( TQString::tqfromLatin1( &buf[pos1], pos-pos1 ) );
|
|
|
|
|
}
|
|
|
|
|
++pos1;
|
|
|
|
|
}
|
|
|
|
@ -1088,7 +1088,7 @@ void CvsIgnoreList::addEntry(const TQString& pattern)
|
|
|
|
|
unsigned int nofMetaCharacters = 0;
|
|
|
|
|
|
|
|
|
|
const TQChar* pos;
|
|
|
|
|
pos = pattern.unicode();
|
|
|
|
|
pos = pattern.tqunicode();
|
|
|
|
|
const TQChar* posEnd;
|
|
|
|
|
posEnd=pos + pattern.length();
|
|
|
|
|
while (pos < posEnd)
|
|
|
|
@ -1344,7 +1344,7 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive,
|
|
|
|
|
//connect( pListJob, TQT_SIGNAL(percent(KIO::Job*,unsigned long)), this, TQT_SLOT(slotPercent(KIO::Job*, unsigned long)));
|
|
|
|
|
|
|
|
|
|
g_pProgressDialog->enterEventLoop( pListJob,
|
|
|
|
|
i18n("Listing directory: %1").arg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
i18n("Listing directory: %1").tqarg(m_pFileAccess->prettyAbsPath()) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1454,27 +1454,27 @@ ProgressDialog::ProgressDialog( TQWidget* pParent )
|
|
|
|
|
: TQDialog( pParent, 0, true )
|
|
|
|
|
{
|
|
|
|
|
m_bStayHidden = false;
|
|
|
|
|
TQVBoxLayout* layout = new TQVBoxLayout(this);
|
|
|
|
|
TQVBoxLayout* tqlayout = new TQVBoxLayout(this);
|
|
|
|
|
|
|
|
|
|
m_pInformation = new TQLabel( " ", this );
|
|
|
|
|
layout->addWidget( m_pInformation );
|
|
|
|
|
tqlayout->addWidget( m_pInformation );
|
|
|
|
|
|
|
|
|
|
m_pProgressBar = new KProgress(1000, this);
|
|
|
|
|
layout->addWidget( m_pProgressBar );
|
|
|
|
|
tqlayout->addWidget( m_pProgressBar );
|
|
|
|
|
|
|
|
|
|
m_pSubInformation = new TQLabel( " ", this);
|
|
|
|
|
layout->addWidget( m_pSubInformation );
|
|
|
|
|
tqlayout->addWidget( m_pSubInformation );
|
|
|
|
|
|
|
|
|
|
m_pSubProgressBar = new KProgress(1000, this);
|
|
|
|
|
layout->addWidget( m_pSubProgressBar );
|
|
|
|
|
tqlayout->addWidget( m_pSubProgressBar );
|
|
|
|
|
|
|
|
|
|
m_pSlowJobInfo = new TQLabel( " ", this);
|
|
|
|
|
layout->addWidget( m_pSlowJobInfo );
|
|
|
|
|
tqlayout->addWidget( m_pSlowJobInfo );
|
|
|
|
|
|
|
|
|
|
TQHBoxLayout* hlayout = new TQHBoxLayout( layout );
|
|
|
|
|
hlayout->addStretch(1);
|
|
|
|
|
TQHBoxLayout* htqlayout = new TQHBoxLayout( tqlayout );
|
|
|
|
|
htqlayout->addStretch(1);
|
|
|
|
|
m_pAbortButton = new TQPushButton( i18n("&Cancel"), this);
|
|
|
|
|
hlayout->addWidget( m_pAbortButton );
|
|
|
|
|
htqlayout->addWidget( m_pAbortButton );
|
|
|
|
|
connect( m_pAbortButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAbort()) );
|
|
|
|
|
|
|
|
|
|
m_progressDelayTimer = 0;
|
|
|
|
|