|
|
|
@ -39,9 +39,8 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
SaveOrRun(QNetworkReply* reply, Executor* executor, |
|
|
|
|
QString type, QString src, |
|
|
|
|
QWidget* p=0): QWidget(p), _reply(reply), _executor(executor) { |
|
|
|
|
SaveOrRun(QNetworkReply* reply, QString type, QString src, QWidget* p=0): |
|
|
|
|
QWidget(p), _reply(reply) { |
|
|
|
|
TRC; |
|
|
|
|
setupUi(this); |
|
|
|
|
QString obj(remoteFilename()); |
|
|
|
@ -61,7 +60,7 @@ namespace qbrowserlib { |
|
|
|
|
TRC; |
|
|
|
|
QString filename(remoteFilename()); |
|
|
|
|
QStringList type |
|
|
|
|
(_executor->settings()->mimetype |
|
|
|
|
(qbrowserlib::Executor::instance().settings()->mimetype |
|
|
|
|
(_reply->header(QNetworkRequest::ContentTypeHeader).toString(), |
|
|
|
|
filename)); |
|
|
|
|
if (!type.isEmpty()) { |
|
|
|
@ -69,9 +68,11 @@ namespace qbrowserlib { |
|
|
|
|
hide(); |
|
|
|
|
filename.replace(QRegExp("^(.*)\\."+type.at(0)+"$"), |
|
|
|
|
"\\1"); // remove extension
|
|
|
|
|
assert(connect(_executor, SIGNAL(applicationStarted()), |
|
|
|
|
assert(connect(&qbrowserlib::Executor::instance(), |
|
|
|
|
SIGNAL(applicationStarted()), |
|
|
|
|
SIGNAL(accept()))); |
|
|
|
|
_executor->run(_reply, filename+"."+type.at(0), type.at(1)); |
|
|
|
|
qbrowserlib::Executor::instance().run |
|
|
|
|
(_reply, filename+"."+type.at(0), type.at(1)); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
@ -132,7 +133,8 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
void run() { |
|
|
|
|
TRC; LOG<<program()<<filename(); |
|
|
|
|
_executor->run(_reply, filename(), program()+" %1"); |
|
|
|
|
qbrowserlib::Executor::instance().run |
|
|
|
|
(_reply, filename(), program()+" %1"); |
|
|
|
|
accept(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -219,8 +221,6 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
friend class SaveOrRunDialog; |
|
|
|
|
QNetworkReply* _reply; |
|
|
|
|
Executor* _executor; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class SaveOrRunPlugin: public SaveOrRun { |
|
|
|
@ -228,11 +228,10 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
SaveOrRunPlugin(QNetworkReply* reply, Executor* executor, |
|
|
|
|
SaveOrRunPlugin(QNetworkReply* reply, |
|
|
|
|
const QUrl& url, const QString& mime, |
|
|
|
|
bool kiosk=false, QWidget* p=0): |
|
|
|
|
SaveOrRun(reply, executor, |
|
|
|
|
mime, url.toString(), p) { |
|
|
|
|
SaveOrRun(reply, mime, url.toString(), p) { |
|
|
|
|
TRC; |
|
|
|
|
setAutoFillBackground(true); |
|
|
|
|
_type->setText(mime); |
|
|
|
@ -253,10 +252,9 @@ namespace qbrowserlib { |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
SaveOrRunDialog(QNetworkReply* reply, Executor* executor, |
|
|
|
|
QString type, QString src, |
|
|
|
|
SaveOrRunDialog(QNetworkReply* reply, QString type, QString src, |
|
|
|
|
bool kiosk=false, QWidget* p=0): |
|
|
|
|
QDialog(p), _sor(new SaveOrRun(reply, executor, type, src)) { |
|
|
|
|
QDialog(p), _sor(new SaveOrRun(reply, type, src)) { |
|
|
|
|
TRC; |
|
|
|
|
setWindowTitle(tr("Unknown File Type")); |
|
|
|
|
QVBoxLayout* l(new QVBoxLayout(this)); |
|
|
|
|