diff --git a/src/browser.hxx b/src/browser.hxx index 7a2582d..1af3b86 100644 --- a/src/browser.hxx +++ b/src/browser.hxx @@ -148,6 +148,10 @@ class Browser: public QMainWindow, protected Ui::Browser { } _editbookmarks = std::auto_ptr(new EditBookmarks(combo, this)); + assert(connect(_editbookmarks.get(), SIGNAL(startEdit()), + actionAddBookmark, SLOT(setDisabled()))); + assert(connect(_editbookmarks.get(), SIGNAL(endEdit()), + actionAddBookmark, SLOT(setEnabled()))); } else { QLineEdit* label(new QLineEdit(_toolbar)); _url = label; @@ -184,16 +188,16 @@ class Browser: public QMainWindow, protected Ui::Browser { assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(finished(QNetworkReply*)))); assert(connect(&_networkManager, SIGNAL(created(QNetworkReply*)), - _downloadManager.get(), SLOT(add(QNetworkReply*)))); - assert(connect(_downloadManager.get(), SIGNAL(progress(qint64, qint64)), + _downloadManager.data(), SLOT(add(QNetworkReply*)))); + assert(connect(_downloadManager.data(), SIGNAL(progress(qint64, qint64)), SLOT(progress(qint64, qint64)))); - assert(connect(_downloadManager.get(), SIGNAL(started()), + assert(connect(_downloadManager.data(), SIGNAL(started()), SLOT(started()))); - assert(connect(_downloadManager.get(), SIGNAL(finished()), + assert(connect(_downloadManager.data(), SIGNAL(finished()), SLOT(finished()))); - assert(connect(_downloadManager.get(), SIGNAL(error(QString)), + assert(connect(_downloadManager.data(), SIGNAL(error(QString)), SLOT(downloadError(QString)))); - assert(connect(_downloadManager.get(), SIGNAL(metaDataChanged(QNetworkReply*)), + assert(connect(_downloadManager.data(), SIGNAL(metaDataChanged(QNetworkReply*)), SLOT(metaDataChanged(QNetworkReply*)))); assert(connect(&_settings, SIGNAL(newSettings()), SLOT(newSettings()))); newSettings(); @@ -1532,7 +1536,7 @@ class Browser: public QMainWindow, protected Ui::Browser { bool _kiosk; QPrinter _printer; SslClientAuthNetworkAccessManager _networkManager; - std::shared_ptr _downloadManager; + QSharedPointer _downloadManager; typedef std::map DownloadProcesses; DownloadProcesses _downloadProcesses; Settings _settings; diff --git a/src/editbookmarks.hxx b/src/editbookmarks.hxx index 34f631e..73f0c2e 100644 --- a/src/editbookmarks.hxx +++ b/src/editbookmarks.hxx @@ -17,6 +17,9 @@ class EditBookmarks: public QDialog, protected Ui::EditBookmarks { Q_OBJECT; + Q_SIGNALS: + void startEdit(); + void endEdit(); public: EditBookmarks(QComboBox* url, QWidget* p=0): QDialog(p), _url(url) { setupUi(this); @@ -33,11 +36,7 @@ class EditBookmarks: public QDialog, protected Ui::EditBookmarks { QDialog::accept(); } virtual void reject() { - QStringList urls; - for (int i(0); i<_url->count(); ++i) - urls<<_url->itemText(i); - _bookmarks->clear(); - _bookmarks->addItems(urls); + reset(); QDialog::reject(); } protected Q_SLOTS: @@ -53,6 +52,23 @@ class EditBookmarks: public QDialog, protected Ui::EditBookmarks { void on__add_clicked(bool) { _bookmarks->addItem(_url->currentText()); } + protected: + virtual void hideEvent(QHideEvent *event) { + QDialog::hideEvent(event); + endEdit(); + } + virtual void showEvent(QShowEvent *event) { + startEdit(); + reset(); + QDialog::showEvent(event); + } + void reset() { + QStringList urls; + for (int i(0); i<_url->count(); ++i) + urls<<_url->itemText(i); + _bookmarks->clear(); + _bookmarks->addItems(urls); + } private: QComboBox* _url; }; diff --git a/src/qmake.pro.in b/src/qmake.pro.in index e87ac18..0dc9f5b 100644 --- a/src/qmake.pro.in +++ b/src/qmake.pro.in @@ -1,6 +1,7 @@ QT += webkit network gui QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto -QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter -std=c++0x +QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter +#-std=c++0x QMAKE_INCDIR += @top_srcdir@/src QMAKE_LIBDIR += @top_builddir@/src/qbrowserlib QMAKE_LIBS += -lqbrowserlib