|
|
@ -155,6 +155,8 @@ class Browser: public QMainWindow, protected Ui::Browser { |
|
|
|
actionAddBookmark, SLOT(setDisabled(bool)))); |
|
|
|
actionAddBookmark, SLOT(setDisabled(bool)))); |
|
|
|
assert(connect(_editbookmarks.get(), SIGNAL(endEdit(bool)), |
|
|
|
assert(connect(_editbookmarks.get(), SIGNAL(endEdit(bool)), |
|
|
|
actionAddBookmark, SLOT(setEnabled(bool)))); |
|
|
|
actionAddBookmark, SLOT(setEnabled(bool)))); |
|
|
|
|
|
|
|
assert(connect(_editbookmarks.get(), SIGNAL(accepted()), |
|
|
|
|
|
|
|
SLOT(saveBookmarks()))); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
QLineEdit* label(new QLineEdit(_toolbar)); |
|
|
|
QLineEdit* label(new QLineEdit(_toolbar)); |
|
|
|
_url = label; |
|
|
|
_url = label; |
|
|
@ -596,6 +598,7 @@ class Browser: public QMainWindow, protected Ui::Browser { |
|
|
|
QAction* a(_bookmarks->addAction(url->currentText())); |
|
|
|
QAction* a(_bookmarks->addAction(url->currentText())); |
|
|
|
a->setData(url->currentText()); |
|
|
|
a->setData(url->currentText()); |
|
|
|
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory())); |
|
|
|
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory())); |
|
|
|
|
|
|
|
saveBookmarks(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -858,13 +861,18 @@ class Browser: public QMainWindow, protected Ui::Browser { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void saveBookmarks() { |
|
|
|
void saveBookmarks() { |
|
|
|
|
|
|
|
LOG<<"Saving Bookmarks ..."; |
|
|
|
QStringList urls; |
|
|
|
QStringList urls; |
|
|
|
if (qobject_cast<QComboBox*>(_url)) |
|
|
|
if (qobject_cast<QComboBox*>(_url)) |
|
|
|
for (int i(0); i<qobject_cast<QComboBox*>(_url)->count(); ++i) |
|
|
|
for (int i(0); i<qobject_cast<QComboBox*>(_url)->count(); ++i) |
|
|
|
urls<<qobject_cast<QComboBox*>(_url)->itemText(i); |
|
|
|
urls<<qobject_cast<QComboBox*>(_url)->itemText(i); |
|
|
|
if (!(_bookmarkfile.writeable() && _bookmarkfile.write(urls)) |
|
|
|
if (_bookmarkfile.writeable()) { |
|
|
|
&& _settings()) |
|
|
|
LOG<<"write to bookmark file"; |
|
|
|
|
|
|
|
_bookmarkfile.write(urls); |
|
|
|
|
|
|
|
} else if (_settings()) { |
|
|
|
|
|
|
|
LOG<<"write to settings"; |
|
|
|
_settings()->setValue("Window/Urls", urls); |
|
|
|
_settings()->setValue("Window/Urls", urls); |
|
|
|
|
|
|
|
} else LOG<<"bookmarks not saved"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void loadWin() { |
|
|
|
void loadWin() { |
|
|
@ -885,9 +893,15 @@ class Browser: public QMainWindow, protected Ui::Browser { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void loadBookmarks() { |
|
|
|
void loadBookmarks() { |
|
|
|
QStringList urls(_bookmarkfile.readable() |
|
|
|
LOG<<"Loading Bookmarks ..."; |
|
|
|
?_bookmarkfile.read() |
|
|
|
QStringList urls; |
|
|
|
:_settings()->value("Window/Urls").toStringList()); |
|
|
|
if (_bookmarkfile.readable()) { |
|
|
|
|
|
|
|
LOG<<"load from file"; |
|
|
|
|
|
|
|
urls = _bookmarkfile.read(); |
|
|
|
|
|
|
|
} else if (_settings()) { |
|
|
|
|
|
|
|
LOG<<"load from settings"; |
|
|
|
|
|
|
|
urls = _settings()->value("Window/Urls").toStringList(); |
|
|
|
|
|
|
|
} |
|
|
|
if (qobject_cast<QComboBox*>(_url)) { |
|
|
|
if (qobject_cast<QComboBox*>(_url)) { |
|
|
|
qobject_cast<QComboBox*>(_url)->clear(); |
|
|
|
qobject_cast<QComboBox*>(_url)->clear(); |
|
|
|
qobject_cast<QComboBox*>(_url)->addItems(urls); |
|
|
|
qobject_cast<QComboBox*>(_url)->addItems(urls); |
|
|
|