Unknown filetypes show a dialog where the user can choose between «save as» and «open with». If there is a plugin handler, we catch it and decide whether to pass to the plugin-handler or to handle it ourself (we do so, if the mime type is registered, otherwise we pass to the plugin handler). If the mimetype is known and registered, we launch the configured application, otherwise we show th edialog mentioned above.; refs #79
This commit is contained in:
@@ -18,51 +18,56 @@
|
||||
//! @addtogroup qbrowserlib
|
||||
//! @{
|
||||
|
||||
//! QWebViev class with additional features.
|
||||
/*! This QWebView class contains a @ref SwissWebPage and adds a new
|
||||
signal @refs newView that sends the view whenever the a new view
|
||||
(new window, new tab) must be opened.
|
||||
namespace qbrowserlib {
|
||||
|
||||
\copydetails SwissWebView::newView(SwissWebView*)
|
||||
*/
|
||||
class SwissWebView: public QWebView {
|
||||
Q_OBJECT;
|
||||
signals:
|
||||
//! Signals that a new window (or tab) must be opened
|
||||
/*! @note You @b must connect to @ref newView and assign the new
|
||||
@ref SwissWebView instance to a partent widget or at least
|
||||
delete it, otherwise you'll have a memory leak! */
|
||||
void newView(SwissWebView*);
|
||||
public:
|
||||
//! Default construction, creates new @ref SwissWebView
|
||||
SwissWebView(QWidget *parent=0): QWebView(parent) {
|
||||
//! @bugfix, gcc does not yet support constructor calling
|
||||
x(new SwissWebPage);
|
||||
}
|
||||
//! Construction with externally allocated @ref SwissWebPage
|
||||
/*! SwissWebView takes ownership of SwissWebPage. */
|
||||
SwissWebView(SwissWebPage* webpage) {
|
||||
//! QWebViev class with additional features.
|
||||
/*! This QWebView class contains a @ref SwissWebPage and adds a new
|
||||
signal @refs newView that sends the view whenever the a new view
|
||||
(new window, new tab) must be opened.
|
||||
|
||||
\copydetails SwissWebView::newView(SwissWebView*)
|
||||
*/
|
||||
class SwissWebView: public QWebView {
|
||||
Q_OBJECT;
|
||||
signals:
|
||||
//! Signals that a new window (or tab) must be opened
|
||||
/*! @note You @b must connect to @ref newView and assign the new
|
||||
@ref SwissWebView instance to a partent widget or at least
|
||||
delete it, otherwise you'll have a memory leak! */
|
||||
void newView(qbrowserlib::SwissWebView*);
|
||||
public:
|
||||
//! Default construction, creates new @ref SwissWebView
|
||||
SwissWebView(QNetworkAccessManager* net,
|
||||
Executor* executor, QWidget *parent=0): QWebView(parent) {
|
||||
//! @bugfix, gcc does not yet support constructor calling
|
||||
x(new SwissWebPage(net, executor, this));
|
||||
}
|
||||
//! Construction with externally allocated @ref SwissWebPage
|
||||
/*! SwissWebView takes ownership of SwissWebPage. */
|
||||
SwissWebView(SwissWebPage* webpage) {
|
||||
//! @bugfix, gcc does not yet support constructor calling
|
||||
x(webpage);
|
||||
}
|
||||
private:
|
||||
//! @bugfix, gcc does not yet support constructor calling
|
||||
x(webpage);
|
||||
}
|
||||
private:
|
||||
//! @bugfix, gcc does not yet support constructor calling
|
||||
/*! @see http://en.wikipedia.org/wiki/C++11#Object_construction_improvement
|
||||
*/
|
||||
void x(SwissWebPage* webpage) {
|
||||
webpage->setParent(this);
|
||||
setPage(webpage);
|
||||
// create a new SwissWebView when a new SwissWebPage has been created
|
||||
assert(connect(page(), SIGNAL(newPage(SwissWebPage*)),
|
||||
SLOT(newPage(SwissWebPage*))));
|
||||
}
|
||||
private slots:
|
||||
void newPage(SwissWebPage* p) {
|
||||
// memory will be lost if signal is not handled and SwissWebView
|
||||
// is not assigned
|
||||
newView(new SwissWebView(p));
|
||||
}
|
||||
};
|
||||
/*! @see http://en.wikipedia.org/wiki/C++11#Object_construction_improvement
|
||||
*/
|
||||
void x(SwissWebPage* webpage) {
|
||||
webpage->setParent(this);
|
||||
setPage(webpage);
|
||||
// create a new SwissWebView when a new SwissWebPage has been created
|
||||
assert(connect(page(), SIGNAL(newPage(SwissWebPage*)),
|
||||
SLOT(newPage(SwissWebPage*))));
|
||||
}
|
||||
private slots:
|
||||
void newPage(SwissWebPage* p) {
|
||||
// memory will be lost if signal is not handled and SwissWebView
|
||||
// is not assigned
|
||||
newView(new SwissWebView(p));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//! @}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user