TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jobtest.cpp 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /* This file is part of the KDE project
  2. Copyright (C) 2004-2006 David Faure <faure@kde.org>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #include "jobtest.h"
  17. #include <config.h>
  18. #include <kurl.h>
  19. #include <tdeapplication.h>
  20. #include <klargefile.h>
  21. #include <tdeio/netaccess.h>
  22. #include <kdebug.h>
  23. #include <tdecmdlineargs.h>
  24. #include <kprotocolinfo.h>
  25. #include <tqfileinfo.h>
  26. #include <tqeventloop.h>
  27. #include <tqdir.h>
  28. #include <tqfileinfo.h>
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include <assert.h>
  32. #include <unistd.h>
  33. #include <errno.h>
  34. #include <sys/time.h>
  35. #include <sys/types.h>
  36. #include <time.h>
  37. #include <utime.h>
  38. // The code comes partly from tdebase/tdeioslave/trash/testtrash.cpp
  39. static bool check(const TQString& txt, TQString a, TQString b)
  40. {
  41. if (a.isEmpty())
  42. a = TQString::null;
  43. if (b.isEmpty())
  44. b = TQString::null;
  45. if (a == b) {
  46. kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
  47. }
  48. else {
  49. kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
  50. exit(1);
  51. }
  52. return true;
  53. }
  54. int main(int argc, char *argv[])
  55. {
  56. TDEApplication::disableAutoDcopRegistration();
  57. TDECmdLineArgs::init(argc,argv,"jobtest", 0, 0, 0, 0);
  58. TDEApplication app;
  59. JobTest test;
  60. test.setup();
  61. test.runAll();
  62. test.cleanup();
  63. kdDebug() << "All tests OK." << endl;
  64. return 0; // success. The exit(1) in check() is what happens in case of failure.
  65. }
  66. TQString JobTest::homeTmpDir() const
  67. {
  68. return TQDir::homeDirPath() + "/.trinity/jobtest/";
  69. }
  70. TQString JobTest::otherTmpDir() const
  71. {
  72. // This one needs to be on another partition
  73. return "/tmp/jobtest/";
  74. }
  75. KURL JobTest::systemTmpDir() const
  76. {
  77. return "system:/home/.trinity/jobtest-system/";
  78. }
  79. TQString JobTest::realSystemPath() const
  80. {
  81. return TQDir::homeDirPath() + "/.trinity/jobtest-system/";
  82. }
  83. void JobTest::setup()
  84. {
  85. // Start with a clean base dir
  86. cleanup();
  87. TQDir dir; // TT: why not a static method?
  88. bool ok = dir.mkdir( homeTmpDir() );
  89. if ( !ok )
  90. kdFatal() << "Couldn't create " << homeTmpDir() << endl;
  91. ok = dir.mkdir( otherTmpDir() );
  92. if ( !ok )
  93. kdFatal() << "Couldn't create " << otherTmpDir() << endl;
  94. ok = dir.mkdir( realSystemPath() );
  95. if ( !ok )
  96. kdFatal() << "Couldn't create " << realSystemPath() << endl;
  97. }
  98. void JobTest::runAll()
  99. {
  100. get();
  101. copyFileToSamePartition();
  102. copyDirectoryToSamePartition();
  103. copyDirectoryToExistingDirectory();
  104. copyFileToOtherPartition();
  105. copyDirectoryToOtherPartition();
  106. listRecursive();
  107. moveFileToSamePartition();
  108. moveDirectoryToSamePartition();
  109. moveFileToOtherPartition();
  110. moveSymlinkToOtherPartition();
  111. moveDirectoryToOtherPartition();
  112. moveFileNoPermissions();
  113. moveDirectoryNoPermissions();
  114. copyFileToSystem();
  115. }
  116. void JobTest::cleanup()
  117. {
  118. TDEIO::NetAccess::del( homeTmpDir(), 0 );
  119. TDEIO::NetAccess::del( otherTmpDir(), 0 );
  120. TDEIO::NetAccess::del( systemTmpDir(), 0 );
  121. }
  122. static void setTimeStamp( const TQString& path )
  123. {
  124. #ifdef Q_OS_UNIX
  125. // Put timestamp in the past so that we can check that the
  126. // copy actually preserves it.
  127. struct timeval tp;
  128. gettimeofday( &tp, 0 );
  129. struct utimbuf utbuf;
  130. utbuf.actime = tp.tv_sec - 30; // 30 seconds ago
  131. utbuf.modtime = tp.tv_sec - 60; // 60 second ago
  132. utime( TQFile::encodeName( path ), &utbuf );
  133. tqDebug( "Time changed for %s", path.latin1() );
  134. #endif
  135. }
  136. static void createTestFile( const TQString& path )
  137. {
  138. TQFile f( path );
  139. if ( !f.open( IO_WriteOnly ) )
  140. kdFatal() << "Can't create " << path << endl;
  141. f.tqwriteBlock( "Hello world", 11 );
  142. f.close();
  143. setTimeStamp( path );
  144. }
  145. static void createTestSymlink( const TQString& path )
  146. {
  147. // Create symlink if it doesn't exist yet
  148. KDE_struct_stat buf;
  149. if ( KDE_lstat( TQFile::encodeName( path ), &buf ) != 0 ) {
  150. bool ok = symlink( "/IDontExist", TQFile::encodeName( path ) ) == 0; // broken symlink
  151. if ( !ok )
  152. kdFatal() << "couldn't create symlink: " << strerror( errno ) << endl;
  153. }
  154. }
  155. static void createTestDirectory( const TQString& path )
  156. {
  157. TQDir dir;
  158. bool ok = dir.mkdir( path );
  159. if ( !ok && !dir.exists() )
  160. kdFatal() << "couldn't create " << path << endl;
  161. createTestFile( path + "/testfile" );
  162. createTestSymlink( path + "/testlink" );
  163. setTimeStamp( path );
  164. }
  165. void JobTest::get()
  166. {
  167. kdDebug() << k_funcinfo << endl;
  168. const TQString filePath = homeTmpDir() + "fileFromHome";
  169. createTestFile( filePath );
  170. KURL u; u.setPath( filePath );
  171. m_result = -1;
  172. TDEIO::StoredTransferJob* job = TDEIO::storedGet( u );
  173. connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ),
  174. this, TQT_SLOT( slotGetResult( TDEIO::Job* ) ) );
  175. kapp->eventLoop()->enterLoop();
  176. assert( m_result == 0 ); // no error
  177. assert( m_data.size() == 11 );
  178. assert( memcmp (m_data, "Hello world", m_data.size()) == 0 ); // m_data is not null-terminated
  179. }
  180. void JobTest::slotGetResult( TDEIO::Job* job )
  181. {
  182. m_result = job->error();
  183. m_data = static_cast<TDEIO::StoredTransferJob *>(job)->data();
  184. kapp->eventLoop()->exitLoop();
  185. }
  186. ////
  187. void JobTest::copyLocalFile( const TQString& src, const TQString& dest )
  188. {
  189. KURL u;
  190. u.setPath( src );
  191. KURL d;
  192. d.setPath( dest );
  193. // copy the file with file_copy
  194. bool ok = TDEIO::NetAccess::file_copy( u, d );
  195. assert( ok );
  196. assert( TQFile::exists( dest ) );
  197. assert( TQFile::exists( src ) ); // still there
  198. {
  199. // check that the timestamp is the same (#24443)
  200. // Note: this only works because of copy() in tdeio_file.
  201. // The datapump solution ignores mtime, the app has to call FileCopyJob::setModificationTime()
  202. TQFileInfo srcInfo( src );
  203. TQFileInfo destInfo( dest );
  204. assert( srcInfo.lastModified() == destInfo.lastModified() );
  205. }
  206. // cleanup and retry with TDEIO::copy()
  207. TQFile::remove( dest );
  208. ok = TDEIO::NetAccess::dircopy( u, d, 0 );
  209. assert( ok );
  210. assert( TQFile::exists( dest ) );
  211. assert( TQFile::exists( src ) ); // still there
  212. {
  213. // check that the timestamp is the same (#24443)
  214. TQFileInfo srcInfo( src );
  215. TQFileInfo destInfo( dest );
  216. assert( srcInfo.lastModified() == destInfo.lastModified() );
  217. }
  218. }
  219. void JobTest::copyLocalDirectory( const TQString& src, const TQString& _dest, int flags )
  220. {
  221. assert( TQFileInfo( src ).isDir() );
  222. assert( TQFileInfo( src + "/testfile" ).isFile() );
  223. KURL u;
  224. u.setPath( src );
  225. TQString dest( _dest );
  226. KURL d;
  227. d.setPath( dest );
  228. if ( flags & AlreadyExists )
  229. assert( TQFile::exists( dest ) );
  230. else
  231. assert( !TQFile::exists( dest ) );
  232. bool ok = TDEIO::NetAccess::dircopy( u, d, 0 );
  233. assert( ok );
  234. if ( flags & AlreadyExists ) {
  235. dest += "/" + u.fileName();
  236. //kdDebug() << "Expecting dest=" << dest << endl;
  237. }
  238. assert( TQFile::exists( dest ) );
  239. assert( TQFileInfo( dest ).isDir() );
  240. assert( TQFileInfo( dest + "/testfile" ).isFile() );
  241. assert( TQFile::exists( src ) ); // still there
  242. {
  243. // check that the timestamp is the same (#24443)
  244. TQFileInfo srcInfo( src );
  245. TQFileInfo destInfo( dest );
  246. assert( srcInfo.lastModified() == destInfo.lastModified() );
  247. }
  248. }
  249. void JobTest::copyFileToSamePartition()
  250. {
  251. kdDebug() << k_funcinfo << endl;
  252. const TQString filePath = homeTmpDir() + "fileFromHome";
  253. const TQString dest = homeTmpDir() + "fileFromHome_copied";
  254. createTestFile( filePath );
  255. copyLocalFile( filePath, dest );
  256. }
  257. void JobTest::copyDirectoryToSamePartition()
  258. {
  259. kdDebug() << k_funcinfo << endl;
  260. const TQString src = homeTmpDir() + "dirFromHome";
  261. const TQString dest = homeTmpDir() + "dirFromHome_copied";
  262. createTestDirectory( src );
  263. copyLocalDirectory( src, dest );
  264. }
  265. void JobTest::copyDirectoryToExistingDirectory()
  266. {
  267. kdDebug() << k_funcinfo << endl;
  268. // just the same as copyDirectoryToSamePartition, but it means that
  269. // this time dest exists.
  270. const TQString src = homeTmpDir() + "dirFromHome";
  271. const TQString dest = homeTmpDir() + "dirFromHome_copied";
  272. createTestDirectory( src );
  273. copyLocalDirectory( src, dest, AlreadyExists );
  274. }
  275. void JobTest::copyFileToOtherPartition()
  276. {
  277. kdDebug() << k_funcinfo << endl;
  278. const TQString filePath = homeTmpDir() + "fileFromHome";
  279. const TQString dest = otherTmpDir() + "fileFromHome_copied";
  280. createTestFile( filePath );
  281. copyLocalFile( filePath, dest );
  282. }
  283. void JobTest::copyDirectoryToOtherPartition()
  284. {
  285. kdDebug() << k_funcinfo << endl;
  286. const TQString src = homeTmpDir() + "dirFromHome";
  287. const TQString dest = otherTmpDir() + "dirFromHome_copied";
  288. // src is already created by copyDirectoryToSamePartition()
  289. // so this is just in case someone calls this method only
  290. if ( !TQFile::exists( src ) )
  291. createTestDirectory( src );
  292. copyLocalDirectory( src, dest );
  293. }
  294. void JobTest::moveLocalFile( const TQString& src, const TQString& dest )
  295. {
  296. assert( TQFile::exists( src ) );
  297. KURL u;
  298. u.setPath( src );
  299. KURL d;
  300. d.setPath( dest );
  301. // move the file with file_move
  302. bool ok = TDEIO::NetAccess::file_move( u, d );
  303. assert( ok );
  304. assert( TQFile::exists( dest ) );
  305. assert( !TQFile::exists( src ) ); // not there anymore
  306. // move it back with TDEIO::move()
  307. ok = TDEIO::NetAccess::move( d, u, 0 );
  308. assert( ok );
  309. assert( !TQFile::exists( dest ) );
  310. assert( TQFile::exists( src ) ); // it's back
  311. }
  312. static void moveLocalSymlink( const TQString& src, const TQString& dest )
  313. {
  314. KDE_struct_stat buf;
  315. assert ( KDE_lstat( TQFile::encodeName( src ), &buf ) == 0 );
  316. KURL u;
  317. u.setPath( src );
  318. KURL d;
  319. d.setPath( dest );
  320. // move the symlink with move, NOT with file_move
  321. bool ok = TDEIO::NetAccess::move( u, d );
  322. if ( !ok )
  323. kdWarning() << TDEIO::NetAccess::lastError() << endl;
  324. assert( ok );
  325. assert ( KDE_lstat( TQFile::encodeName( dest ), &buf ) == 0 );
  326. assert( !TQFile::exists( src ) ); // not there anymore
  327. // move it back with TDEIO::move()
  328. ok = TDEIO::NetAccess::move( d, u, 0 );
  329. assert( ok );
  330. assert ( KDE_lstat( TQFile::encodeName( dest ), &buf ) != 0 ); // doesn't exist anymore
  331. assert ( KDE_lstat( TQFile::encodeName( src ), &buf ) == 0 ); // it's back
  332. }
  333. void JobTest::moveLocalDirectory( const TQString& src, const TQString& dest )
  334. {
  335. assert( TQFile::exists( src ) );
  336. assert( TQFileInfo( src ).isDir() );
  337. assert( TQFileInfo( src + "/testfile" ).isFile() );
  338. assert( TQFileInfo( src + "/testlink" ).isSymLink() );
  339. KURL u;
  340. u.setPath( src );
  341. KURL d;
  342. d.setPath( dest );
  343. bool ok = TDEIO::NetAccess::move( u, d, 0 );
  344. assert( ok );
  345. assert( TQFile::exists( dest ) );
  346. assert( TQFileInfo( dest ).isDir() );
  347. assert( TQFileInfo( dest + "/testfile" ).isFile() );
  348. assert( !TQFile::exists( src ) ); // not there anymore
  349. assert( TQFileInfo( dest + "/testlink" ).isSymLink() );
  350. }
  351. void JobTest::moveFileToSamePartition()
  352. {
  353. kdDebug() << k_funcinfo << endl;
  354. const TQString filePath = homeTmpDir() + "fileFromHome";
  355. const TQString dest = homeTmpDir() + "fileFromHome_moved";
  356. createTestFile( filePath );
  357. moveLocalFile( filePath, dest );
  358. }
  359. void JobTest::moveDirectoryToSamePartition()
  360. {
  361. kdDebug() << k_funcinfo << endl;
  362. const TQString src = homeTmpDir() + "dirFromHome";
  363. const TQString dest = homeTmpDir() + "dirFromHome_moved";
  364. createTestDirectory( src );
  365. moveLocalDirectory( src, dest );
  366. }
  367. void JobTest::moveFileToOtherPartition()
  368. {
  369. kdDebug() << k_funcinfo << endl;
  370. const TQString filePath = homeTmpDir() + "fileFromHome";
  371. const TQString dest = otherTmpDir() + "fileFromHome_moved";
  372. createTestFile( filePath );
  373. moveLocalFile( filePath, dest );
  374. }
  375. void JobTest::moveSymlinkToOtherPartition()
  376. {
  377. kdDebug() << k_funcinfo << endl;
  378. const TQString filePath = homeTmpDir() + "testlink";
  379. const TQString dest = otherTmpDir() + "testlink_moved";
  380. createTestSymlink( filePath );
  381. moveLocalSymlink( filePath, dest );
  382. }
  383. void JobTest::moveDirectoryToOtherPartition()
  384. {
  385. kdDebug() << k_funcinfo << endl;
  386. const TQString src = homeTmpDir() + "dirFromHome";
  387. const TQString dest = otherTmpDir() + "dirFromHome_moved";
  388. createTestDirectory( src );
  389. moveLocalDirectory( src, dest );
  390. }
  391. void JobTest::moveFileNoPermissions()
  392. {
  393. kdDebug() << k_funcinfo << endl;
  394. const TQString src = "/etc/passwd";
  395. const TQString dest = homeTmpDir() + "passwd";
  396. assert( TQFile::exists( src ) );
  397. assert( TQFileInfo( src ).isFile() );
  398. KURL u;
  399. u.setPath( src );
  400. KURL d;
  401. d.setPath( dest );
  402. TDEIO::CopyJob* job = TDEIO::move( u, d, 0 );
  403. job->setInteractive( false ); // no skip dialog, thanks
  404. TQMap<TQString, TQString> metaData;
  405. bool ok = TDEIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
  406. assert( !ok );
  407. assert( TDEIO::NetAccess::lastError() == TDEIO::ERR_ACCESS_DENIED );
  408. // OK this is fishy. Just like mv(1), TDEIO's behavior depends on whether
  409. // a direct rename(2) was used, or a full copy+del. In the first case
  410. // there is no destination file created, but in the second case the
  411. // destination file remains.
  412. // In fact we assume /home is a separate partition, in this test, so:
  413. assert( TQFile::exists( dest ) );
  414. assert( TQFile::exists( src ) );
  415. }
  416. void JobTest::moveDirectoryNoPermissions()
  417. {
  418. kdDebug() << k_funcinfo << endl;
  419. const TQString src = "/etc/init.d";
  420. const TQString dest = homeTmpDir() + "init.d";
  421. assert( TQFile::exists( src ) );
  422. assert( TQFileInfo( src ).isDir() );
  423. KURL u;
  424. u.setPath( src );
  425. KURL d;
  426. d.setPath( dest );
  427. TDEIO::CopyJob* job = TDEIO::move( u, d, 0 );
  428. job->setInteractive( false ); // no skip dialog, thanks
  429. TQMap<TQString, TQString> metaData;
  430. bool ok = TDEIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
  431. assert( !ok );
  432. assert( TDEIO::NetAccess::lastError() == TDEIO::ERR_ACCESS_DENIED );
  433. assert( TQFile::exists( dest ) ); // see moveFileNoPermissions
  434. assert( TQFile::exists( src ) );
  435. }
  436. void JobTest::listRecursive()
  437. {
  438. const TQString src = homeTmpDir();
  439. KURL u;
  440. u.setPath( src );
  441. TDEIO::ListJob* job = TDEIO::listRecursive( u );
  442. connect( job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ),
  443. TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) );
  444. bool ok = TDEIO::NetAccess::synchronousRun( job, 0 );
  445. assert( ok );
  446. m_names.sort();
  447. check( "listRecursive", m_names.join( "," ), ".,..,"
  448. "dirFromHome,dirFromHome/testfile,dirFromHome/testlink,dirFromHome_copied,"
  449. "dirFromHome_copied/dirFromHome,dirFromHome_copied/dirFromHome/testfile,dirFromHome_copied/dirFromHome/testlink,"
  450. "dirFromHome_copied/testfile,dirFromHome_copied/testlink,"
  451. "fileFromHome,fileFromHome_copied" );
  452. }
  453. void JobTest::slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& lst )
  454. {
  455. for( TDEIO::UDSEntryList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
  456. TDEIO::UDSEntry::ConstIterator it2 = (*it).begin();
  457. TQString displayName;
  458. KURL url;
  459. for( ; it2 != (*it).end(); it2++ ) {
  460. switch ((*it2).m_uds) {
  461. case TDEIO::UDS_NAME:
  462. displayName = (*it2).m_str;
  463. break;
  464. case TDEIO::UDS_URL:
  465. url = (*it2).m_str;
  466. break;
  467. }
  468. }
  469. m_names.append( displayName );
  470. }
  471. }
  472. void JobTest::copyFileToSystem()
  473. {
  474. if ( !KProtocolInfo::isKnownProtocol( TQString::fromLatin1( "system" ) ) ) {
  475. kdDebug() << k_funcinfo << "no tdeio_system, skipping test" << endl;
  476. return;
  477. }
  478. // First test with support for UDS_LOCAL_PATH
  479. copyFileToSystem( true );
  480. TQString dest = realSystemPath() + "fileFromHome_copied";
  481. TQFile::remove( dest );
  482. // Then disable support for UDS_LOCAL_PATH, i.e. test what would
  483. // happen for ftp, smb, http etc.
  484. copyFileToSystem( false );
  485. }
  486. void JobTest::copyFileToSystem( bool resolve_local_urls )
  487. {
  488. kdDebug() << k_funcinfo << resolve_local_urls << endl;
  489. extern TDEIO_EXPORT bool tdeio_resolve_local_urls;
  490. tdeio_resolve_local_urls = resolve_local_urls;
  491. const TQString src = homeTmpDir() + "fileFromHome";
  492. createTestFile( src );
  493. KURL u;
  494. u.setPath( src );
  495. KURL d = systemTmpDir();
  496. d.addPath( "fileFromHome_copied" );
  497. kdDebug() << "copying " << u << " to " << d << endl;
  498. // copy the file with file_copy
  499. TDEIO::FileCopyJob* job = TDEIO::file_copy( u, d );
  500. connect( job, TQT_SIGNAL(mimetype(TDEIO::Job*,const TQString&)),
  501. this, TQT_SLOT(slotMimetype(TDEIO::Job*,const TQString&)) );
  502. bool ok = TDEIO::NetAccess::synchronousRun( job, 0 );
  503. assert( ok );
  504. TQString dest = realSystemPath() + "fileFromHome_copied";
  505. assert( TQFile::exists( dest ) );
  506. assert( TQFile::exists( src ) ); // still there
  507. {
  508. // do NOT check that the timestamp is the same.
  509. // It can't work with file_copy when it uses the datapump,
  510. // unless we use setModificationTime in the app code.
  511. }
  512. // Check mimetype
  513. kdDebug() << m_mimetype << endl;
  514. // There's no mimemagic determination in tdeio_file in trinity. Fixing this for kde4...
  515. assert( m_mimetype == "application/octet-stream" );
  516. //assert( m_mimetype == "text/plain" );
  517. // cleanup and retry with TDEIO::copy()
  518. TQFile::remove( dest );
  519. ok = TDEIO::NetAccess::dircopy( u, d, 0 );
  520. assert( ok );
  521. assert( TQFile::exists( dest ) );
  522. assert( TQFile::exists( src ) ); // still there
  523. {
  524. // check that the timestamp is the same (#79937)
  525. TQFileInfo srcInfo( src );
  526. TQFileInfo destInfo( dest );
  527. assert( srcInfo.lastModified() == destInfo.lastModified() );
  528. }
  529. // restore normal behavior
  530. tdeio_resolve_local_urls = true;
  531. }
  532. void JobTest::slotMimetype(TDEIO::Job* job, const TQString& type)
  533. {
  534. assert( job );
  535. m_mimetype = type;
  536. }
  537. #include "jobtest.moc"