kget
urlchecker.cpp
Go to the documentation of this file.
44 ExistingTransferDialog::ExistingTransferDialog(const QString &text, const QString &caption, QWidget *parent)
64 buttonBox->addButton(KStandardGuiItem::yes(), QDialogButtonBox::YesRole, this, SLOT(slotYesClicked()));
65 buttonBox->addButton(KStandardGuiItem::no(), QDialogButtonBox::NoRole, this, SLOT(slotNoClicked()));
66 buttonBox->addButton(KStandardGuiItem::cancel(), QDialogButtonBox::RejectRole, this, SLOT(slotCancelClicked()));
117 boost::bind(&KUrl::equals, _1, _2, KUrl::CompareWithoutTrailingSlash | KUrl::AllowEmptyPath)), urls.end());
120 UrlChecker::UrlError UrlChecker::checkUrl(const KUrl &url, const UrlChecker::UrlType type, bool showNotification)
136 return (dest.isLocalFile() && QFile::exists(dest.toLocalFile()) && source != dest && !FileDeleter::isFileBeingDeleted(dest));
141 //NOTE hasPath is not used, as this would dissallow adresses like http://www.kde.org/ as there is no path
152 /*if ((error == NoError) && !src.hasHost()) {//FIXME deactivated to allow file://....metalink etc
161 //TODO also check sourceUrl.url() != KUrl(sourceUrl.url()).fileName() as in NewTransferDialog::setSource?
166 UrlChecker::UrlError UrlChecker::checkDestination(const KUrl &destination, bool showNotification)
242 TransferHandler *UrlChecker::existingTransfer(const KUrl &url, const UrlChecker::UrlType type, UrlChecker::UrlWarning *warning)
258 TransferHandler *UrlChecker::existingSource(const KUrl &source, UrlChecker::UrlWarning &warning)
273 TransferHandler *UrlChecker::existingDestination(const KUrl &url, UrlChecker::UrlWarning &warning)
290 QString UrlChecker::message(const KUrl &url, const UrlChecker::UrlType type, const UrlChecker::UrlError error)
376 QString UrlChecker::message(const KUrl &url, const UrlChecker::UrlType type, const UrlChecker::UrlWarning warning)
384 return i18n("You have already downloaded that file from another location.\nDownload and delete the previous one?");
386 return i18n("You are already downloading that file from another location.\nDownload and delete the previous one?");
398 return i18n("You have a download in progress from that location.\nDelete it and download again?");
410 return i18n("You have already downloaded that file from another location.\nDownload and delete the previous one?");
412 return i18n("You are already downloading that file from another location.\nDownload and delete the previous one?");
420 return i18n("You have already completed a download from the location: \n\n%1\n\nDownload it again?", urlString);
422 return i18n("You have a download in progress from the location: \n\n%1\n\nDelete it and download again?", urlString);
432 QString UrlChecker::message(const KUrl::List &urls, const UrlChecker::UrlType type, const UrlChecker::UrlError error)
481 QString UrlChecker::message(const KUrl::List &urls, const UrlChecker::UrlType type, const UrlChecker::UrlWarning warning)
498 return i18n("You have already completed downloads at those destinations. Download them again?");
500 return i18n("You have downloads in progress to these destinations.\nDelete them and download again?");
510 return i18n("You have downloads in progress from these locations.\nDelete them and download again?");
521 return i18n("You have already completed downloads at those destinations: \n\n%1\n\n Download them again?", urlsString);
523 return i18n("You have downloads in progress to these destinations: \n\n%1\n\nDelete them and download again?", urlsString);
531 return i18n("You have already completed downloads from these locations: \n\n%1\n\nDownload them again?", urlsString);
533 return i18n("You have downloads in progress from these locations: \n\n%1\n\nDelete them and download again?", urlsString);
544 KUrl::List UrlChecker::hasExistingTransferMessages(const KUrl::List &urls, const UrlChecker::UrlType type)
585 if (Settings::filesOverwrite() || (Settings::filesAutomaticRename() && (warning != ExistingTransfer))) {
624 int UrlChecker::hasExistingDialog(const KUrl &url, const UrlChecker::UrlType type, const UrlChecker::UrlWarning warning)
655 QScopedPointer<KDialog> dialog(new ExistingTransferDialog(message(url, type, warning), caption, parent));
743 KIO::RenameDialog_Mode args = static_cast<KIO::RenameDialog_Mode>(KIO::M_MULTI | KIO::M_SKIP | KIO::M_OVERWRITE);
744 QScopedPointer<KIO::RenameDialog> dlg(new KIO::RenameDialog(KGet::m_mainWindow, i18n("File already exists"), source,
Transfer * findTransfer(const KUrl &src)
Definition: transfertreemodel.cpp:467
Definition: urlchecker.h:61
The job is stopped, but this also indicates that it stopped because an error occurred.
Definition: job.h:47
KUrl::List correctUrls() const
Returns the correct urls collected with the last call to urlCollectErrors.
Definition: urlchecker.cpp:797
static bool delTransfers(const QList< TransferHandler * > &transfers, DeleteMode mode=AutoDelete)
Removes multiple transfers from the KGet.
Definition: kget.cpp:367
static UrlError checkDestination(const KUrl &destination, bool showNotification=false)
Convenience method of checkUrl.
Definition: urlchecker.cpp:166
Definition: urlchecker.h:77
static UrlError checkUrl(const KUrl &url, const UrlType type, bool showNotification=false)
Folder: Checks if the destination url points to is a folder that is writeable and existent...
Definition: urlchecker.cpp:120
void clear()
Clears all data, like correctUrls, errorUrls, responses from checkExistingFile ...
Definition: urlchecker.cpp:676
static KJob * deleteFile(const KUrl &dest, QObject *receiver=0, const char *method=0)
Starts the deletion of dest and emits KJob::finished once done.
Definition: filedeleter.cpp:73
UrlChecker(UrlType type)
Before using UrlChecker you have to specify a type You can either do that in the constructor and late...
Definition: urlchecker.cpp:90
Definition: urlchecker.h:40
static KUrl::List hasExistingTransferMessages(const KUrl::List &urls, const UrlType type)
Definition: urlchecker.cpp:544
Definition: urlchecker.h:38
Definition: urlchecker.h:62
static KUrl destUrl(const KUrl &destOrFolder, const KUrl &source, const QString &fileName=QString())
Takes an url to a source and an url to either the destination or a folder and returns a destination u...
Definition: urlchecker.cpp:225
Definition: urlchecker.h:67
void existingTransfers()
Checks all correctUrls() if there are existing Transfers for the specified UrlType and asks the user ...
Definition: urlchecker.cpp:722
ExistingTransferDialog(const QString &text, const QString &caption, QWidget *parent=0)
Definition: urlchecker.cpp:44
bool addUrls(const KUrl::List &urls)
Does checkUrl for a list of urls.
Definition: urlchecker.cpp:709
static QString message(const KUrl &url, const UrlType type, const UrlError error)
Get a describing message for UrlError.
Definition: urlchecker.cpp:290
static TransferHandler * existingTransfer(const KUrl &url, const UrlType type, UrlWarning *warning=0)
Checks if there is an existing transfer for url with type.
Definition: urlchecker.cpp:242
Definition: urlchecker.h:74
static UrlError checkSource(const KUrl &source, bool showNotification=false)
Convenience method of checkUrl.
Definition: urlchecker.cpp:139
Definition: urlchecker.h:66
Definition: urlchecker.h:63
static void removeDuplicates(KUrl::List &urls)
Removes duplicates of a list of urls.
Definition: urlchecker.cpp:113
Transfer * findTransferByDestination(const KUrl &dest)
Definition: transfertreemodel.cpp:483
QHash< UrlError, KUrl::List > splitErrorUrls() const
Returns all wrong urls collected with the last call to urlCollectErrors or existingTransfers categori...
Definition: urlchecker.cpp:815
Definition: urlchecker.h:39
KUrl checkExistingFile(const KUrl &source, const KUrl &destination)
Checks if the file at destination exists already, source needs to be defined to have a nice dialog an...
Definition: urlchecker.cpp:727
static KNotification * showNotification(QWidget *parent, const QString &eventType, const QString &text, const QString &icon=QString("dialog-error"), const QString &title=i18n("KGet"), const KNotification::NotificationFlags &flags=KNotification::CloseOnTimeout)
Shows a knotification.
Definition: kget.cpp:1281
Definition: urlchecker.h:70
static bool isFileBeingDeleted(const KUrl &dest)
Definition: filedeleter.cpp:78
Asks if existing transfers should be overwritten.
Definition: urlchecker_p.h:30
void displayErrorMessages()
Displays error messages for the collected urls if any are needed.
Definition: urlchecker.cpp:820
Definition: urlchecker.h:80
static UrlError checkFolder(const KUrl &folder, bool showNotification=false)
Convenience method of checkUrl.
Definition: urlchecker.cpp:195
static bool wouldOverwrite(const KUrl &source, const KUrl &dest)
Checks if source is local and exists already.
Definition: urlchecker.cpp:134
void setType(UrlType type)
Sets the type for the following operations to type.
Definition: urlchecker.cpp:691
Definition: transfer.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.