From c471c0e8823b47f762602c5b4df164a38a6b67ff Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 11 Jul 2012 18:31:23 +0200 Subject: [PATCH] Version 1.3.0 --- CHANGELOG | 2 +- README.md | 2 +- src/lib/app/profileupdater.cpp | 37 +++++++++++++++++++++++--- src/lib/app/profileupdater.h | 1 + src/lib/app/qupzilla.cpp | 2 +- src/lib/bookmarks/bookmarkstoolbar.cpp | 12 ++++----- 6 files changed, 44 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d526650ae..93cae7e98 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,5 @@ Version 1.3.0 - * not released yet + * released 11 July 2012 * new Ukrainian translation * new plugins: GreaseMonkey and PIM (Personal Information Manager) * new command line option to open new window with url diff --git a/README.md b/README.md index 10df1b828..94448312d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ You need to specify path to `macdeployqt` only if it is not in PATH. Current version ---------------------------------------------------------------------------------------- -The current released version of QupZilla is 1.2.0. You can download precompiled packages +The current released version of QupZilla is 1.3.0. You can download precompiled packages and the sources from the download section at [homepage](http://www.qupzilla.com/download). However, if you want the latest revision, just take the latest code snapshot either by downloading a tarball or running: diff --git a/src/lib/app/profileupdater.cpp b/src/lib/app/profileupdater.cpp index 5d0839305..3168285c3 100644 --- a/src/lib/app/profileupdater.cpp +++ b/src/lib/app/profileupdater.cpp @@ -72,6 +72,7 @@ void ProfileUpdater::updateProfile(const QString ¤t, const QString &profil update100rc1(); update100(); update118(); + update120(); return; } @@ -79,27 +80,37 @@ void ProfileUpdater::updateProfile(const QString ¤t, const QString &profil update100rc1(); update100(); update118(); + update120(); return; } if (profileVersion == Updater::parseVersionFromString("1.0.0")) { update100(); update118(); + update120(); return; } if (profileVersion == Updater::parseVersionFromString("1.1.0")) { - // Do nothing, nothing changed + update118(); + update120(); return; } if (profileVersion == Updater::parseVersionFromString("1.1.5")) { - // Do nothing, nothing changed + update118(); + update120(); return; } if (profileVersion == Updater::parseVersionFromString("1.1.8")) { update118(); + update120(); + return; + } + + if (profileVersion == Updater::parseVersionFromString("1.2.0")) { + update120(); return; } @@ -150,7 +161,6 @@ void ProfileUpdater::update100rc1() query.exec("ALTER TABLE bookmarks ADD COLUMN toolbar_position NUMERIC"); query.exec("UPDATE bookmarks SET toolbar_position=0"); - } void ProfileUpdater::update100() @@ -171,3 +181,24 @@ void ProfileUpdater::update118() QSqlQuery query; query.exec("ALTER TABLE folders ADD COLUMN parent TEXT"); } + +void ProfileUpdater::update120() +{ + std::cout << "QupZilla: Upgrading profile version from 1.2.0..." << std::endl; + mApp->connectDatabase(); + + QSqlDatabase db = QSqlDatabase::database(); + db.transaction(); + + // This is actually just renaming bookmarks.toolbar_position to bookmarks.position + QSqlQuery query; + query.exec("ALTER TABLE bookmarks RENAME TO tmp_bookmarks"); + query.exec("CREATE TABLE bookmarks (icon TEXT, folder TEXT, id INTEGER PRIMARY KEY, title VARCHAR(200), url VARCHAR(200), position NUMERIC)"); + query.exec("INSERT INTO bookmarks(icon, folder, id, title, url, position)" + "SELECT icon, folder, id, title, url, toolbar_position FROM tmp_bookmarks"); + query.exec("DROP TABLE tmp_bookmarks"); + query.exec("CREATE INDEX bookmarksTitle ON bookmarks(title ASC)"); + query.exec("CREATE INDEX bookmarksUrl ON bookmarks(url ASC)"); + + db.commit(); +} diff --git a/src/lib/app/profileupdater.h b/src/lib/app/profileupdater.h index 3d38e0e73..e95ceadea 100644 --- a/src/lib/app/profileupdater.h +++ b/src/lib/app/profileupdater.h @@ -36,6 +36,7 @@ private: void update100rc1(); void update100(); void update118(); + void update120(); QString m_profilePath; }; diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 1aec2b5d7..e9b5a4201 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -79,7 +79,7 @@ #include #include -const QString QupZilla::VERSION = "1.2.0"; +const QString QupZilla::VERSION = "1.3.0"; const QString QupZilla::BUILDTIME = __DATE__" "__TIME__; const QString QupZilla::AUTHOR = "David Rosca"; const QString QupZilla::COPYRIGHT = "2010-2012"; diff --git a/src/lib/bookmarks/bookmarkstoolbar.cpp b/src/lib/bookmarks/bookmarkstoolbar.cpp index f72908110..4e6ffe0d9 100644 --- a/src/lib/bookmarks/bookmarkstoolbar.cpp +++ b/src/lib/bookmarks/bookmarkstoolbar.cpp @@ -142,12 +142,12 @@ void BookmarksToolbar::moveRight() Bookmark bookmarkRight = buttonRight->data().value(); QSqlQuery query; - query.prepare("UPDATE bookmarks SET toolbar_position=? WHERE id=?"); + query.prepare("UPDATE bookmarks SET position=? WHERE id=?"); query.addBindValue(index + 1); query.addBindValue(bookmark.id); mApp->dbWriter()->executeQuery(query); - query.prepare("UPDATE bookmarks SET toolbar_position=? WHERE id=?"); + query.prepare("UPDATE bookmarks SET position=? WHERE id=?"); query.addBindValue(index); query.addBindValue(bookmarkRight.id); mApp->dbWriter()->executeQuery(query); @@ -179,12 +179,12 @@ void BookmarksToolbar::moveLeft() Bookmark bookmarkLeft = buttonLeft->data().value(); QSqlQuery query; - query.prepare("UPDATE bookmarks SET toolbar_position=? WHERE id=?"); + query.prepare("UPDATE bookmarks SET position=? WHERE id=?"); query.addBindValue(index - 1); query.addBindValue(bookmark.id); mApp->dbWriter()->executeQuery(query); - query.prepare("UPDATE bookmarks SET toolbar_position=? WHERE id=?"); + query.prepare("UPDATE bookmarks SET position=? WHERE id=?"); query.addBindValue(index); query.addBindValue(bookmarkLeft.id); mApp->dbWriter()->executeQuery(query); @@ -419,7 +419,7 @@ void BookmarksToolbar::addBookmark(const BookmarksModel::Bookmark &bookmark) m_layout->insertWidget(indexForBookmark, button); QSqlQuery query; - query.prepare("UPDATE bookmarks SET toolbar_position=? WHERE id=?"); + query.prepare("UPDATE bookmarks SET position=? WHERE id=?"); query.addBindValue(indexForBookmark); query.addBindValue(bookmark.id); mApp->dbWriter()->executeQuery(query); @@ -482,7 +482,7 @@ void BookmarksToolbar::bookmarkEdited(const BookmarksModel::Bookmark &before, co void BookmarksToolbar::refreshBookmarks() { QSqlQuery query; - query.exec("SELECT id, title, url, icon FROM bookmarks WHERE folder='bookmarksToolbar' ORDER BY toolbar_position"); + query.exec("SELECT id, title, url, icon FROM bookmarks WHERE folder='bookmarksToolbar' ORDER BY position"); while (query.next()) { Bookmark bookmark; bookmark.id = query.value(0).toInt();