This commit is contained in:
Martin Rotter 2014-10-07 16:37:44 +02:00
parent f8945e1da0
commit 07b7d1d6ee
6 changed files with 46 additions and 10 deletions

View File

@ -3,7 +3,7 @@
Fixed: Fixed:
<ul> <ul>
<li>Fixed #76, #75, #82, #79.</li> <li>Fixed #76, #75, #82, #79, #85.</li>
</ul> </ul>
Added: Added:

View File

@ -607,6 +607,11 @@ void FormSettings::loadGeneral() {
tr(" (not supported on this platform)")); tr(" (not supported on this platform)"));
break; break;
} }
#if defined(Q_OS_WIN)
m_ui->m_checkRemoveTrolltechJunk->setEnabled(true);
m_ui->m_checkRemoveTrolltechJunk->setChecked(qApp->settings()->value(APP_CFG_GEN, "remove_trolltech_junk", false).toBool());
#endif
} }
void FormSettings::saveGeneral() { void FormSettings::saveGeneral() {
@ -619,6 +624,7 @@ void FormSettings::saveGeneral() {
} }
qApp->settings()->setValue(APP_CFG_GEN, "update_on_start", m_ui->m_checkForUpdatesOnStart->isChecked()); qApp->settings()->setValue(APP_CFG_GEN, "update_on_start", m_ui->m_checkForUpdatesOnStart->isChecked());
qApp->settings()->setValue(APP_CFG_GEN, "remove_trolltech_junk", m_ui->m_checkRemoveTrolltechJunk->isChecked());
} }
void FormSettings::loadInterface() { void FormSettings::loadInterface() {

View File

@ -123,6 +123,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkRemoveTrolltechJunk">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove junk Trolltech registry key (HKCUSoftwareTrolltech) whn application quits (Use at your own risk!)</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="m_pageDataStorage"> <widget class="QWidget" name="m_pageDataStorage">

View File

@ -142,6 +142,7 @@ void Application::onAboutToQuit() {
qDebug("Cleaning up resources and saving application state."); qDebug("Cleaning up resources and saving application state.");
system()->removeTrolltechJunkRegistryKeys();
mainForm()->tabWidget()->feedMessageViewer()->quit(); mainForm()->tabWidget()->feedMessageViewer()->quit();
database()->saveDatabase(); database()->saveDatabase();
mainForm()->saveSize(); mainForm()->saveSize();

View File

@ -123,13 +123,11 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
} }
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QSettings registry_key("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings registry_key("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
QSettings::NativeFormat);
switch (new_status) { switch (new_status) {
case SystemFactory::Enabled: case SystemFactory::Enabled:
registry_key.setValue(APP_LOW_NAME, registry_key.setValue(APP_LOW_NAME,
Application::applicationFilePath().replace('/', Application::applicationFilePath().replace('/', '\\'));
'\\'));
return true; return true;
case SystemFactory::Disabled: case SystemFactory::Disabled:
registry_key.remove(APP_LOW_NAME); registry_key.remove(APP_LOW_NAME);
@ -156,6 +154,22 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
#endif #endif
} }
#if defined(Q_OS_WIN)
bool SystemFactory::removeTrolltechJunkRegistryKeys() {
if (qApp->settings()->value(APP_CFG_GEN, "remove_trolltech_junk", false).toBool()) {
QSettings registry_key("HKEY_CURRENT_USER\\Software\\TrollTech", QSettings::NativeFormat);
registry_key.remove("");
registry_key.sync();
return registry_key.status() == QSettings::NoError;
}
else {
return false;
}
}
#endif
QPair<UpdateInfo, QNetworkReply::NetworkError> SystemFactory::checkForUpdates() { QPair<UpdateInfo, QNetworkReply::NetworkError> SystemFactory::checkForUpdates() {
QPair<UpdateInfo, QNetworkReply::NetworkError> result; QPair<UpdateInfo, QNetworkReply::NetworkError> result;
QByteArray releases_xml; QByteArray releases_xml;

View File

@ -79,6 +79,10 @@ class SystemFactory : public QObject {
// new status failed. // new status failed.
bool setAutoStartStatus(const SystemFactory::AutoStartStatus &new_status); bool setAutoStartStatus(const SystemFactory::AutoStartStatus &new_status);
#if defined(Q_OS_WIN)
bool removeTrolltechJunkRegistryKeys();
#endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
// Returns standard location where auto-start .desktop files // Returns standard location where auto-start .desktop files
// should be placed. // should be placed.
@ -89,6 +93,7 @@ class SystemFactory : public QObject {
QPair<UpdateInfo, QNetworkReply::NetworkError> checkForUpdates(); QPair<UpdateInfo, QNetworkReply::NetworkError> checkForUpdates();
public slots: public slots:
// Performs asynchronous check for updates, result is emitted via updateCheckedAsynchronously(...) signal.
void checkForUpdatesAsynchronously(); void checkForUpdatesAsynchronously();
private slots: private slots: