1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fixed recalculating size of tabs after unpinning tab.

+ other small improvements / fixes
This commit is contained in:
nowrep 2012-03-14 14:04:20 +01:00
parent b25489ae8c
commit f09e5c981c
13 changed files with 73 additions and 86 deletions

View File

@ -41,8 +41,8 @@ void CommandLineOptions::showHelp()
" -a or --authors print QupZilla authors \n"
" -v or --version print QupZilla version \n"
"\n"
" -p or --profile=<profile> start with specified profile \n"
" -np or --no-plugins start without plugins \n"
" -p=PROFILE or --profile=PROFILE start with specified profile \n"
" -ne or --no-extensions start without extensions\n"
"\n"
" Options to control running QupZilla:\n"
" -nt or --new-tab open new tab\n"
@ -106,7 +106,7 @@ void CommandLineOptions::parseActions()
m_actions.append(pair);
}
if (arg.startsWith("-np") || arg.startsWith("--no-plugins")) {
if (arg.startsWith("-ne") || arg.startsWith("--no-extensions")) {
ActionPair pair;
pair.action = Qz::CL_StartWithoutAddons;
pair.text = "";

View File

@ -57,7 +57,6 @@
#include <QSettings>
#include <QTimer>
#include <QTranslator>
#include <QMessageBox>
#ifdef Q_WS_WIN
#define DEFAULT_CHECK_UPDATES true
@ -90,20 +89,19 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
, m_networkmanager(0)
, m_cookiejar(0)
, m_rssmanager(0)
, m_updater(0)
, m_plugins(0)
, m_bookmarksModel(0)
, m_downloadManager(0)
, m_autofill(0)
, m_networkCache(new QNetworkDiskCache)
, m_networkCache(new QNetworkDiskCache(this))
, m_desktopNotifications(0)
, m_iconProvider(new IconProvider(this))
, m_searchEnginesManager(0)
, m_dbWriter(new DatabaseWriter())
, m_dbWriter(new DatabaseWriter(this))
, m_isClosing(false)
, m_isStateChanged(false)
, m_isExited(false)
, m_isRestoring(false)
, m_startingAfterCrash(false)
, m_databaseConnected(false)
{
#if defined(Q_WS_X11) && !defined(NO_SYSTEM_DATAPATH)
@ -174,7 +172,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
foreach(const QString & message, messages) {
sendMessage(message);
}
m_isExited = true;
m_isClosing = true;
return;
}
@ -211,13 +209,10 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
Settings::createSettings(m_activeProfil + "settings.ini");
Settings settings2;
settings2.beginGroup("SessionRestore");
if (settings2.value("isRunning", false).toBool()) {
settings2.setValue("isCrashed", true);
}
settings2.setValue("isRunning", true);
settings2.endGroup();
Settings settings;
m_startingAfterCrash = settings.value("SessionRestore/isRunning", false).toBool();
bool checkUpdates = settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool();
settings.setValue("SessionRestore/isRunning", true);
translateApp();
@ -228,10 +223,6 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
connect(qupzilla, SIGNAL(message(Qz::AppMessageType, bool)), this, SLOT(sendMessages(Qz::AppMessageType, bool)));
connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor()));
if (settings2.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool()) {
m_updater = new Updater(qupzilla);
}
loadSettings();
networkManager()->loadCertificates();
@ -239,6 +230,10 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
plugins()->loadPlugins();
}
if (checkUpdates) {
new Updater(qupzilla);
}
QTimer::singleShot(0, this, SLOT(postLaunch()));
#ifdef Q_WS_WIN
QTimer::singleShot(10 * 1000, this, SLOT(setupJumpList()));
@ -602,7 +597,6 @@ void MainApplication::saveSettings()
Settings settings;
settings.beginGroup("SessionRestore");
settings.setValue("isRunning", false);
settings.setValue("isCrashed", false);
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");
@ -767,10 +761,6 @@ bool MainApplication::saveStateSlot()
return false;
}
Settings settings;
settings.beginGroup("SessionRestore");
settings.setValue("restoreSession", false);
QFile file(m_activeProfil + "session.dat");
file.open(QIODevice::WriteOnly);
QDataStream stream(&file);
@ -793,9 +783,6 @@ bool MainApplication::saveStateSlot()
}
file.close();
settings.setValue("restoreSession", true);
settings.endGroup();
QupZilla* qupzilla_ = getWindow();
if (qupzilla_ && m_mainWindows.count() == 1) {
qupzilla_->tabWidget()->savePinnedTabs();
@ -814,28 +801,12 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
}
m_isRestoring = true;
Settings settings;
int afterStart = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
settings.beginGroup("SessionRestore");
if (!settings.value("restoreSession", false).toBool()) {
m_isRestoring = false;
return false;
}
if (settings.value("isCrashed", false).toBool() && afterStart != 3) {
QMessageBox::StandardButton button = QMessageBox::warning(window, tr("Last session crashed"),
tr("<b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (button != QMessageBox::Yes) {
m_isRestoring = false;
return false;
}
}
if (!QFile::exists(m_activeProfil + "session.dat")) {
m_isRestoring = false;
return false;
}
settings.setValue("isCrashed", false);
QFile file(m_activeProfil + "session.dat");
file.open(QIODevice::ReadOnly);
QDataStream stream(&file);

View File

@ -72,7 +72,7 @@ public:
inline QString getActiveProfilPath() { return m_activeProfil; }
inline QString getActiveLanguage() { return m_activeLanguage; }
inline bool isClosing() { return m_isClosing; }
inline bool isExited() { return m_isExited; }
inline bool isStartingAfterCrash() { return m_startingAfterCrash; }
inline int windowCount() { return m_mainWindows.count(); }
bool checkSettingsDir();
@ -132,7 +132,6 @@ private:
NetworkManager* m_networkmanager;
CookieJar* m_cookiejar;
RSSManager* m_rssmanager;
Updater* m_updater;
PluginProxy* m_plugins;
BookmarksModel* m_bookmarksModel;
DownloadManager* m_downloadManager;
@ -151,8 +150,8 @@ private:
bool m_isClosing;
bool m_isStateChanged;
bool m_isExited;
bool m_isRestoring;
bool m_startingAfterCrash;
bool m_databaseConnected;
QList<PostLaunchAction> m_postLaunchActions;

View File

@ -129,15 +129,10 @@ void QupZilla::postLaunch()
}
Settings settings;
settings.beginGroup("Web-URL-Settings");
int afterLaunch = settings.value("afterLaunch", 1).toInt();
settings.endGroup();
settings.beginGroup("SessionRestore");
bool startingAfterCrash = settings.value("isCrashed", false).toBool();
settings.endGroup();
int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
bool addTab = true;
QUrl startUrl;
switch (afterLaunch) {
case 0:
startUrl = QUrl("");
@ -158,9 +153,20 @@ void QupZilla::postLaunch()
switch (m_startBehaviour) {
case Qz::BW_FirstAppWindow:
if (startingAfterCrash || (addTab && afterLaunch == 3)) {
if (afterLaunch == 3) {
addTab = !mApp->restoreStateSlot(this);
}
else if (mApp->isStartingAfterCrash()) {
QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Last session crashed"),
tr("<b>QupZilla crashed :-(</b><br/>Oops, the last session "
"of QupZilla was interrupted unexpectedly. We apologize "
"for this. Would you like to try restoring the last "
"saved state?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (button == QMessageBox::Yes) {
addTab = !mApp->restoreStateSlot(this);
}
}
break;
case Qz::BW_NewWindow:

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<height>327</height>
<width>550</width>
<height>350</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>550</width>
<height>350</height>
</size>
</property>
<property name="windowTitle">
<string>Import Bookmarks</string>
</property>
@ -81,6 +87,16 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; Currently, only import from Html File can import also bookmark folders.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="filePage">

View File

@ -139,7 +139,7 @@ QString QupZillaSchemeReply::reportbugPage()
bPage.replace("%TITLE%", tr("Report Issue"));
bPage.replace("%REPORT-ISSUE%", tr("Report Issue"));
bPage.replace("%PLUGINS-TEXT%", tr("If you are experiencing problems with QupZilla, please try to disable"
" all plugins first. <br/>If this does not fix it, then please fill out this form: "));
" all extenions first. <br/>If this does not fix it, then please fill out this form: "));
bPage.replace("%EMAIL%", tr("Your E-mail"));
bPage.replace("%TYPE%", tr("Issue type"));
bPage.replace("%DESCRIPTION%", tr("Issue description"));
@ -301,14 +301,14 @@ QString QupZillaSchemeReply::configPage()
cPage.replace("%TITLE%", tr("Configuration Information"));
cPage.replace("%CONFIG%", tr("Configuration Information"));
cPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version"));
cPage.replace("%CONFIG-ABOUT%", tr("This page contains information about QupZilla's current configuration, plugins, etc, all relevant information for troubleshooting. Please include these information when sending bug reports."));
cPage.replace("%CONFIG-ABOUT%", tr("This page contains information about QupZilla's current configuration, all relevant information for troubleshooting. Please include these information when sending bug reports."));
cPage.replace("%BROWSER-IDENTIFICATION%", tr("Browser Identification"));
cPage.replace("%PATHS%", tr("Paths"));
cPage.replace("%BUILD-CONFIG%", tr("Build Configuration"));
cPage.replace("%PREFS%", tr("Preferences"));
cPage.replace("%OPTION%", tr("Option"));
cPage.replace("%VALUE%", tr("Value"));
cPage.replace("%PLUGINS%", tr("Plugins"));
cPage.replace("%PLUGINS%", tr("Extensions"));
cPage.replace("%PL-NAME%", tr("Name"));
cPage.replace("%PL-VER%", tr("Version"));
cPage.replace("%PL-AUTH%", tr("Author"));
@ -377,7 +377,7 @@ QString QupZillaSchemeReply::configPage()
}
if (pluginsString.isEmpty()) {
pluginsString = QString("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available plugins."));
pluginsString = QString("<tr><td colspan=4 class=\"no-available-plugins\">%1</td></tr>").arg(tr("No available extensions."));
}
page.replace("%PLUGINS-INFO%", pluginsString);

View File

@ -19,8 +19,8 @@
#include <QTimer>
DatabaseWriter::DatabaseWriter()
: QObject()
DatabaseWriter::DatabaseWriter(QObject *parent)
: QObject(parent)
{
}

View File

@ -28,7 +28,7 @@ class QT_QUPZILLA_EXPORT DatabaseWriter : public QObject
{
Q_OBJECT
public:
explicit DatabaseWriter();
explicit DatabaseWriter(QObject* parent = 0);
void executeQuery(const QSqlQuery &query);

View File

@ -92,20 +92,13 @@ void PluginProxy::registerAppEventHandler(const PluginProxy::EventHandlerType &t
void PluginProxy::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTestResult &r)
{
if (!menu || !view || m_loadedPlugins.count() == 0) {
if (!menu || !view) {
return;
}
menu->addSeparator();
int count = menu->actions().count();
foreach(PluginInterface * iPlugin, m_loadedPlugins) {
iPlugin->populateWebViewMenu(menu, view, r);
}
if (menu->actions().count() == count) {
menu->removeAction(menu->actions().at(count - 1));
}
}
bool PluginProxy::processMouseDoubleClick(const Qz::ObjectName &type, QObject* obj, QMouseEvent* event)

View File

@ -217,7 +217,7 @@ void PluginsList::itemChanged(QListWidgetItem* item)
if (item->checkState() == Qt::Checked && !plugin.isLoaded()) {
item->setCheckState(Qt::Unchecked);
QMessageBox::critical(this, tr("Error!"), tr("Cannot load extensions"));
QMessageBox::critical(this, tr("Error!"), tr("Cannot load extension!"));
}
item->setData(Qt::UserRole + 10, qVariantFromValue(plugin));

View File

@ -310,8 +310,11 @@ void TabBar::pinTab()
m_pinnedTabsCount--;
}
// Adjust add tab button in proper position
tabSizeHint(count() - 1);
// We need to recalculate size of all tabs and repaint tabbar
// Unfortunately, Qt doesn't offer refresh() function as a public API
// So we are calling the lightest function that calls d->refresh()
setElideMode(elideMode());
}
void TabBar::pinnedTabClosed()

View File

@ -37,7 +37,6 @@
#include "networkmanagerproxy.h"
#include "adblockicon.h"
#include <QTextDocument>
#include <QDir>
#include <QWebHistory>
#include <QFileSystemWatcher>
@ -651,7 +650,7 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg)
ui->setupUi(dialog);
ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok);
ui->dontAskAgain->setText(tr("Prevent this page from creating additional dialogs"));
ui->textLabel->setText(Qt::escape(msg));
ui->textLabel->setText(msg);
ui->iconLabel->setPixmap(mApp->style()->standardPixmap(QStyle::SP_MessageBoxInformation));
ui->buttonBox->setFocus();
dialog->setWindowTitle(tr("JavaScript alert - %1").arg(url().host()));

View File

@ -62,7 +62,7 @@ int main(int argc, char* argv[])
MainApplication app(cmdActions, argc, argv);
if (app.isExited()) {
if (app.isClosing()) {
// Not showing any output, otherwise XFCE shows "Failed to execute default browser. I/O error" error
// if (argc == 1) {
// std::cout << "QupZilla already running - activating existing window" << std::endl;