mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Fixed potentional crash on history/cookies loading
- changed settings path for plugins to PROFILE/extensions/
This commit is contained in:
parent
2d4852faac
commit
47ec2b57f7
@ -153,6 +153,7 @@ void CookieManager::slotRefreshTable()
|
||||
ui->cookieTree->clear();
|
||||
|
||||
int counter = 0;
|
||||
QWeakPointer<CookieManager> guard = this;
|
||||
QHash<QString, QTreeWidgetItem*> hash;
|
||||
for (int i = 0; i < allCookies.count(); ++i) {
|
||||
const QNetworkCookie &cookie = allCookies.at(i);
|
||||
@ -188,6 +189,10 @@ void CookieManager::slotRefreshTable()
|
||||
QApplication::processEvents();
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
if (!guard) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
@ -265,6 +265,7 @@ void HistoryManager::slotRefreshTable()
|
||||
query.exec("SELECT title, url, id, date FROM history ORDER BY date DESC");
|
||||
|
||||
int counter = 0;
|
||||
QWeakPointer<HistoryManager> guard = this;
|
||||
QHash<QString, QTreeWidgetItem*> hash;
|
||||
while (query.next()) {
|
||||
const QString &title = query.value(0).toString();
|
||||
@ -315,6 +316,10 @@ void HistoryManager::slotRefreshTable()
|
||||
QApplication::processEvents();
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
if (!guard) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
@ -118,6 +118,11 @@ void Plugins::loadPlugins()
|
||||
return;
|
||||
}
|
||||
|
||||
QDir settingsDir(mApp->getActiveProfilPath() + "extensions/");
|
||||
if (!settingsDir.exists()) {
|
||||
settingsDir.mkdir(settingsDir.absolutePath());
|
||||
}
|
||||
|
||||
foreach(const QString & fullPath, m_allowedPlugins) {
|
||||
QPluginLoader* loader = new QPluginLoader(fullPath);
|
||||
PluginInterface* iPlugin = qobject_cast<PluginInterface*>(loader->instance());
|
||||
@ -191,7 +196,7 @@ PluginInterface* Plugins::initPlugin(PluginInterface* interface, QPluginLoader*
|
||||
return 0;
|
||||
}
|
||||
|
||||
interface->init(mApp->getActiveProfilPath() + "plugins.ini");
|
||||
interface->init(mApp->getActiveProfilPath() + "extensions/");
|
||||
|
||||
if (!interface->testPlugin()) {
|
||||
interface->unload();
|
||||
|
@ -182,6 +182,7 @@ void HistorySideBar::slotRefreshTable()
|
||||
query.exec("SELECT title, url, id, date FROM history ORDER BY date DESC");
|
||||
|
||||
int counter = 0;
|
||||
QWeakPointer<HistorySideBar> guard = this;
|
||||
QHash<QString, QTreeWidgetItem*> hash;
|
||||
while (query.next()) {
|
||||
const QString &title = query.value(0).toString();
|
||||
@ -231,6 +232,10 @@ void HistorySideBar::slotRefreshTable()
|
||||
QApplication::processEvents();
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
if (!guard) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
@ -28,11 +28,11 @@ AKN_Settings::AKN_Settings(AKN_Handler* handler, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AKN_Settings)
|
||||
, m_handler(handler)
|
||||
, m_settingsPath(handler->settingsPath())
|
||||
, m_settingsFile(handler->settingsPath() + "extensions.ini")
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QSettings settings(m_settingsPath, QSettings::IniFormat);
|
||||
QSettings settings(m_settingsFile, QSettings::IniFormat);
|
||||
settings.beginGroup("AccessKeysNavigation");
|
||||
ui->key->setCurrentIndex(settings.value("Key", 0).toInt());
|
||||
ui->doubleClick->setChecked(settings.value("DoublePress", true).toBool());
|
||||
@ -44,7 +44,7 @@ AKN_Settings::AKN_Settings(AKN_Handler* handler, QWidget* parent)
|
||||
|
||||
void AKN_Settings::dialogAccepted()
|
||||
{
|
||||
QSettings settings(m_settingsPath, QSettings::IniFormat);
|
||||
QSettings settings(m_settingsFile, QSettings::IniFormat);
|
||||
settings.beginGroup("AccessKeysNavigation");
|
||||
settings.setValue("Key", ui->key->currentIndex());
|
||||
settings.setValue("DoublePress", ui->doubleClick->isChecked());
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
Ui::AKN_Settings* ui;
|
||||
|
||||
AKN_Handler* m_handler;
|
||||
QString m_settingsPath;
|
||||
QString m_settingsFile;
|
||||
};
|
||||
|
||||
#endif // AKN_SETTINGS_H
|
||||
|
@ -59,6 +59,9 @@ void TestPlugin::init(const QString &sPath)
|
||||
// it will be called even if we return false from testPlugin()
|
||||
// so it is recommended not to call any QupZilla function here
|
||||
|
||||
// Settings path is PROFILE/extensions/, in this directory
|
||||
// you can use global .ini file for QSettings named "extensions.ini"
|
||||
// or create new folder for your plugin and save in it anything you want
|
||||
m_settingsPath = sPath;
|
||||
|
||||
// Registering this plugin as a MousePressHandler.
|
||||
|
Loading…
Reference in New Issue
Block a user