void DialogNewDownload::keyPressEvent(QKeyEvent* _key) { if (_key->key() == Qt::Key_Return) { createDownload(); } }
void DownloadListModel::addDownload(QUrl url, QString outFileName) { AbstractDownload *d = createDownload(url); beginInsertRows(QModelIndex(), 0, 0); downloads.prepend(d); d->downloadToFile(outFileName); endInsertRows(); connect(d, SIGNAL(progress()), this, SLOT(onProgress())); connect(d, SIGNAL(statusChanged()), this, SLOT(onStatusChanged())); }
DialogNewDownload::DialogNewDownload(QMainWindow *parent) : QDialog(parent) { setupUi(this); buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel")); buttonBox->button(QDialogButtonBox::Ok)->setText(tr("&Ok")); metafileOpen->button(QDialogButtonBox::Open)->setText(tr("Open")); destinationOpen->button(QDialogButtonBox::Open)->setText(tr("Open")); tempDirOpen->button(QDialogButtonBox::Open)->setText(tr("Open")); // OK-Button creates new Process connect(buttonBox, SIGNAL(accepted()), this, SLOT(createDownload())); //closes dialog connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); //passes download information to main window connect(this, SIGNAL(createNewDownload(QString, QDir, QDir, QString, QString)), parent, SLOT(createDownloadProcess(QString, QDir, QDir, QString, QString))); //toggles password echo connect(showPWcheck, SIGNAL(toggled(bool)), this, SLOT(togglePasswordEcho(bool))); //selects metafile connect(metafileOpen, SIGNAL(accepted()), this, SLOT(selectMetafile())); //selects destination folder connect(destinationOpen, SIGNAL(accepted()), this, SLOT(selectDestinationFolder())); //selects temporary folder connect(tempDirOpen, SIGNAL(accepted()), this, SLOT(selectTempDirFolder())); decryptCheck->toggle(); }
void ProcessListView::dropEvent(QDropEvent *_event) { if(_event->mimeData()->hasFormat("text/uri-list")) { if(_event->mimeData()->hasUrls()) { if(!((QDir)_event->mimeData()->urls().at(0).toLocalFile()).exists()) { qDebug() << "ProcessListView: dropEvent: " << _event->mimeData()->urls().at(0).toLocalFile(); emit createUpload(_event->mimeData()->urls().at(0).toLocalFile()); } bool isInternetUrl = _event->mimeData()->urls().at(0).toString().contains(QRegExp("^http://*", Qt::CaseSensitive, QRegExp::RegExp2)); if(isInternetUrl) { qDebug() << "ProcessListView: dropEvent: Internet Url "<< _event->mimeData()->urls().at(0).toString().left(45) << " --> " << isInternetUrl; emit createDownload(_event->mimeData()->urls().at(0).toString()); } } } }