[developerteam getadooble] SF.net SVN: dooble:[2272] trunk/browser/Source/dooble.cc
Brought to you by:
textfield
From: <tex...@us...> - 2011-06-04 05:41:22
|
Revision: 2272 http://dooble.svn.sourceforge.net/dooble/?rev=2272&view=rev Author: textfield Date: 2011-06-04 05:41:16 +0000 (Sat, 04 Jun 2011) Log Message: ----------- Fixed opening of new windows as processes. (Missing argument.) Prompt the user for the passphrase upon Dooble launch. Modified Paths: -------------- trunk/browser/Source/dooble.cc Modified: trunk/browser/Source/dooble.cc =================================================================== --- trunk/browser/Source/dooble.cc 2011-06-04 05:40:14 UTC (rev 2271) +++ trunk/browser/Source/dooble.cc 2011-06-04 05:41:16 UTC (rev 2272) @@ -84,6 +84,7 @@ #include "dsettings.h" #include "dpagesourcewindow.h" #include "ui_passwordPrompt.h" +#include "ui_passphrasePrompt.h" /* ** Global objects. @@ -91,7 +92,7 @@ dcookies *dooble::s_cookies = 0; dcookiewindow *dooble::s_cookieWindow = 0; -QCA::SecureArray dooble::s_passphrase; +QCA::SecureArray *dooble::s_passphrase = 0; QHash<QString, QVariant> dooble::s_settings; /* @@ -107,6 +108,8 @@ { QCA::Initializer init; + dooble::s_passphrase = new QCA::SecureArray(); + /* ** Create the Qt application object. */ @@ -961,6 +964,7 @@ QMainWindow(), dest_url_(url.toString(QUrl::StripTrailingSlash)) { init(false); + promptForPassphrase(); newTab(url); if(dooble::s_settings.value("settingsWindow/displayDesktopCheckBox", @@ -993,6 +997,7 @@ dest_url_("") { init(false); + promptForPassphrase(); QStringList urls(hash["urls"].toStringList()); @@ -2952,7 +2957,8 @@ "visits TEXT NOT NULL, " "encrypted INTEGER NOT NULL)"); - if(query.exec(QString("SELECT visits FROM history WHERE url = " + if(query.exec(QString("SELECT visits, encrypted " + "FROM history WHERE url = " "'%1'"). arg(item.url().toString(QUrl::StripTrailingSlash)))) if(query.next()) @@ -2962,7 +2968,7 @@ shouldEncrypt = dooble::s_settings.value ("settingsWindow/encryptHistoryInformation").toBool() && - !dooble::s_passphrase.isEmpty(); + !dooble::s_passphrase->isEmpty(); query.exec("PRAGMA synchronous = OFF"); query.prepare ("INSERT OR REPLACE INTO history " @@ -3243,10 +3249,14 @@ void dooble::launchDooble(const QUrl &url) { QProcess *process = new QProcess(); + QStringList arguments; + arguments << "--url" + << url.toString(QUrl::StripTrailingSlash); process->start(QCoreApplication::applicationDirPath() + QDir::separator() + QCoreApplication::applicationName(), - QStringList(url.toString(QUrl::StripTrailingSlash))); + arguments); + arguments.clear(); } void dooble::slotTabMoved(int from, int to) @@ -3370,3 +3380,58 @@ if(p) ui.tabWidget->setCurrentWidget(p); } + +void dooble::promptForPassphrase(void) +{ + QString hashType(dooble::s_settings.value("settingsWindow/hashType"). + toString()); + + if(doobleCounter == 1 && + dooble::s_settings.contains("settingsWindow/hashType") && + dooble::s_settings.contains("settingsWindow/passphraseHash") && + QCA::isSupported(hashType.toStdString().data())) + { + /* + ** init() must be changed so that it does not query + ** the history table until the passphrase has been + ** verified. + */ + + show(); + + QDialog dialog(this); + Ui_passphrasePrompt ui_p; + + ui_p.setupUi(&dialog); + + do + { + if(dialog.exec() == QDialog::Accepted) + { + QString hash(""); + QString passphrase = ui_p.passphraseLineEdit-> + text(); + + /* + ** Validate the passphrase. + */ + + hash = QCA::Hash(hashType.toStdString().data()). + hashToString(passphrase.toAscii()); + + if(hash == dooble::s_settings.value("settingsWindow/" + "passphraseHash").toString()) + { + *dooble::s_passphrase = ui_p.passphraseLineEdit-> + text().toAscii(); + break; + } + else + ui_p.passphraseLineEdit->clear(); + } + else + break; + } + while(true); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |