src/PartDownloader.cc

changeset 644
93dcd1a0e4bd
parent 642
751a8df42842
equal deleted inserted replaced
643:a79277000830 644:93dcd1a0e4bd
221 221
222 modifyDestination (dest); 222 modifyDestination (dest);
223 223
224 if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest)) 224 if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest))
225 { 225 {
226 const QString overwritemsg = fmt (tr ("%1 already exists in download directory. Overwrite?"), dest); 226 const QString overwritemsg = format (tr ("%1 already exists in download directory. Overwrite?"), dest);
227 if (!confirm (tr ("Overwrite?"), overwritemsg)) 227 if (!confirm (tr ("Overwrite?"), overwritemsg))
228 return; 228 return;
229 } 229 }
230 230
231 downloadButton()->setEnabled (false); 231 downloadButton()->setEnabled (false);
337 // Make sure that we have a valid destination. 337 // Make sure that we have a valid destination.
338 QString dirpath = dirname (filePath()); 338 QString dirpath = dirname (filePath());
339 339
340 QDir dir (dirpath); 340 QDir dir (dirpath);
341 341
342 if (!dir.exists()) 342 if (dir.exists() == false)
343 { 343 {
344 log ("Creating %1...\n", dirpath); 344 print ("Creating %1...\n", dirpath);
345 345
346 if (!dir.mkpath (dirpath)) 346 if (!dir.mkpath (dirpath))
347 critical (fmt (tr ("Couldn't create the directory %1!"), dirpath)); 347 critical (format (tr ("Couldn't create the directory %1!"), dirpath));
348 } 348 }
349 349
350 setNetworkReply (networkManager()->get (QNetworkRequest (QUrl (url)))); 350 setNetworkReply (networkManager()->get (QNetworkRequest (QUrl (url))));
351 connect (networkReply(), SIGNAL (finished()), this, SLOT (downloadFinished())); 351 connect (networkReply(), SIGNAL (finished()), this, SLOT (downloadFinished()));
352 connect (networkReply(), SIGNAL (readyRead()), this, SLOT (readyRead())); 352 connect (networkReply(), SIGNAL (readyRead()), this, SLOT (readyRead()));
399 399
400 QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (tableRow(), labelcol)); 400 QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (tableRow(), labelcol));
401 401
402 if (isFirstUpdate()) 402 if (isFirstUpdate())
403 { 403 {
404 lb = new QLabel (fmt ("<b>%1</b>", destinaton()), table); 404 lb = new QLabel (format ("<b>%1</b>", destinaton()), table);
405 table->setCellWidget (tableRow(), labelcol, lb); 405 table->setCellWidget (tableRow(), labelcol, lb);
406 } 406 }
407 407
408 // Make sure that the cell is big enough to contain the label 408 // Make sure that the cell is big enough to contain the label
409 if (table->columnWidth (labelcol) < lb->width()) 409 if (table->columnWidth (labelcol) < lb->width())
503 // to go here. 503 // to go here.
504 setFilePointer (new QFile (filePath().toLocal8Bit())); 504 setFilePointer (new QFile (filePath().toLocal8Bit()));
505 505
506 if (!filePointer()->open (QIODevice::WriteOnly)) 506 if (!filePointer()->open (QIODevice::WriteOnly))
507 { 507 {
508 critical (fmt (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno))); 508 critical (format (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno)));
509 setState (EFailed); 509 setState (EFailed);
510 networkReply()->abort(); 510 networkReply()->abort();
511 updateToTable(); 511 updateToTable();
512 prompt()->checkIfFinished(); 512 prompt()->checkIfFinished();
513 return; 513 return;

mercurial