1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Possiblity to move up/down in search engines manager and other...

- F6 shortcut for focusing locationbar
- no more empty title in history back/next menus
- showing only active norification preview in preferences
This commit is contained in:
nowrep 2011-12-16 19:07:36 +01:00
parent bed30cb483
commit 2cfd9808ec
14 changed files with 173 additions and 59 deletions

View File

@ -11,6 +11,7 @@ Comment[sk]=Rýchly a bezpečný webový prehliadač
Comment[de]=Ein schneller und sicherer Web Browser Comment[de]=Ein schneller und sicherer Web Browser
Comment[nl]=Een snelle en veilige webbrowser Comment[nl]=Een snelle en veilige webbrowser
Comment[it]=Un browser web veloce e sicuro Comment[it]=Un browser web veloce e sicuro
Comment[pl]=Szybka i bezpieczna przeglądarka internetowa
GenericName=Web Browser GenericName=Web Browser
GenericName[es]=Navegador Web GenericName[es]=Navegador Web
GenericName[cs]=Webový prohlížeč GenericName[cs]=Webový prohlížeč
@ -18,6 +19,7 @@ GenericName[sk]=Webový prehliadač
GenericName[de]=Web Browser GenericName[de]=Web Browser
GenericName[nl]=Webbrowser GenericName[nl]=Webbrowser
GenericName[it]=Browser Web GenericName[it]=Browser Web
GenericName[pl]=Przeglądarka Internetowa
Exec=qupzilla %u Exec=qupzilla %u
MimeType=text/html;application/xhtml+xml; MimeType=text/html;application/xhtml+xml;
Terminal=false Terminal=false

View File

@ -19,7 +19,7 @@ bool TestPlugin::testPlugin()
QTranslator* TestPlugin::getTranslator(QString locale) QTranslator* TestPlugin::getTranslator(QString locale)
{ {
QTranslator* translator = new QTranslator(); QTranslator* translator = new QTranslator();
translator->load(":/"+locale); translator->load(":/" + locale);
return translator; return translator;
} }
@ -27,7 +27,7 @@ void TestPlugin::showSettings()
{ {
QWidget* widget = new QWidget(); QWidget* widget = new QWidget();
new QLabel("Example Plugin v0.0.1", widget); new QLabel("Example Plugin v0.0.1", widget);
widget->resize(200,200); widget->resize(200, 200);
widget->setAttribute(Qt::WA_DeleteOnClose); widget->setAttribute(Qt::WA_DeleteOnClose);
widget->setWindowModality(Qt::WindowModal); //As the preferences window is modal too widget->setWindowModality(Qt::WindowModal); //As the preferences window is modal too
widget->setWindowTitle("Example Plugin Settings"); widget->setWindowTitle("Example Plugin Settings");
@ -35,26 +35,29 @@ void TestPlugin::showSettings()
widget->show(); widget->show();
} }
void TestPlugin::populateWebViewMenu(QMenu *menu, QWebView *view, QWebHitTestResult r) void TestPlugin::populateWebViewMenu(QMenu* menu, QWebView* view, QWebHitTestResult r)
{ {
Q_UNUSED(view) Q_UNUSED(view)
QString title; QString title;
if (!r.imageUrl().isEmpty()) if (!r.imageUrl().isEmpty()) {
title += " on image"; title += " on image";
if (!r.linkUrl().isEmpty()) }
if (!r.linkUrl().isEmpty()) {
title += " on link"; title += " on link";
}
QWebElement element = r.element(); QWebElement element = r.element();
if (!element.isNull() && (element.tagName().toLower() == "input" || element.tagName().toLower() == "textarea")) if (!element.isNull() && (element.tagName().toLower() == "input" || element.tagName().toLower() == "textarea")) {
title += " on input"; title += " on input";
}
menu->addAction(tr("My first plugin action") + title, this, SLOT(actionSlot())); menu->addAction(tr("My first plugin action") + title, this, SLOT(actionSlot()));
} }
void TestPlugin::populateHelpMenu(QMenu *menu) void TestPlugin::populateHelpMenu(QMenu* menu)
{ {
menu->addAction(tr("My first plugin action"), this, SLOT(actionSlot())); menu->addAction(tr("My first plugin action"), this, SLOT(actionSlot()));
} }
void TestPlugin::populateToolsMenu(QMenu *menu) void TestPlugin::populateToolsMenu(QMenu* menu)
{ {
menu->addAction(tr("My first plugin action"), this, SLOT(actionSlot())); menu->addAction(tr("My first plugin action"), this, SLOT(actionSlot()));
} }

View File

@ -34,9 +34,9 @@ public:
bool hasSettings() { return true; } bool hasSettings() { return true; }
void showSettings(); void showSettings();
void populateWebViewMenu(QMenu *menu, QWebView *view, QWebHitTestResult r); void populateWebViewMenu(QMenu* menu, QWebView* view, QWebHitTestResult r);
void populateHelpMenu(QMenu *menu); void populateHelpMenu(QMenu* menu);
void populateToolsMenu(QMenu *menu); void populateToolsMenu(QMenu* menu);
private slots: private slots:
void actionSlot(); void actionSlot();

View File

@ -171,12 +171,12 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
connect(saver, SIGNAL(saveApp()), this, SLOT(saveStateSlot())); connect(saver, SIGNAL(saveApp()), this, SLOT(saveStateSlot()));
if (settings2.value("Web-Browser-Settings/CheckUpdates", if (settings2.value("Web-Browser-Settings/CheckUpdates",
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
true true
#else #else
false false
#endif #endif
).toBool()) { ).toBool()) {
m_updater = new Updater(qupzilla); m_updater = new Updater(qupzilla);
} }

View File

@ -1167,6 +1167,12 @@ void QupZilla::openFile()
} }
} }
void QupZilla::openLocation()
{
locationBar()->setFocus();
locationBar()->selectAll();
}
void QupZilla::showNavigationWithFullscreen() void QupZilla::showNavigationWithFullscreen()
{ {
bool state; bool state;
@ -1307,6 +1313,7 @@ void QupZilla::keyPressEvent(QKeyEvent* event)
searchOnPage(); searchOnPage();
event->accept(); event->accept();
break; break;
case Qt::Key_F6:
case Qt::Key_OpenUrl: case Qt::Key_OpenUrl:
openLocation(); openLocation();
event->accept(); event->accept();

View File

@ -177,7 +177,7 @@ private slots:
void bookmarkAllTabs(); void bookmarkAllTabs();
void newWindow() { mApp->makeNewWindow(false); } void newWindow() { mApp->makeNewWindow(false); }
void openLocation() { locationBar()->setFocus(); locationBar()->selectAll(); } void openLocation();
void openFile(); void openFile();
void savePage(); void savePage();
void sendLink() { QDesktopServices::openUrl(QUrl("mailto:?body=" + weView()->url().toString())); } void sendLink() { QDesktopServices::openUrl(QUrl("mailto:?body=" + weView()->url().toString())); }

View File

@ -24,6 +24,25 @@
#include "webhistorywrapper.h" #include "webhistorywrapper.h"
#include "enhancedmenu.h" #include "enhancedmenu.h"
QString titleForUrl(QString title, const QUrl &url)
{
if (title.isEmpty()) {
title = url.path();
}
if (title.isEmpty()) {
title = url.host();
}
if (title.isEmpty()) {
return NavigationBar::tr("No Named Page");
}
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
return title;
}
NavigationBar::NavigationBar(QupZilla* mainClass, QWidget* parent) NavigationBar::NavigationBar(QupZilla* mainClass, QWidget* parent)
: QWidget(parent) : QWidget(parent)
, p_QupZilla(mainClass) , p_QupZilla(mainClass)
@ -158,11 +177,7 @@ void NavigationBar::aboutToShowHistoryBackMenu()
for (int i = curindex - 1; i >= 0; i--) { for (int i = curindex - 1; i >= 0; i--) {
QWebHistoryItem item = history->itemAt(i); QWebHistoryItem item = history->itemAt(i);
if (item.isValid() && lastUrl != item.url()) { if (item.isValid() && lastUrl != item.url()) {
QString title = item.title(); QString title = titleForUrl(item.title(), item.url());
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(item.url()), title); Action* act = new Action(_iconForUrl(item.url()), title);
act->setData(i); act->setData(i);
@ -198,11 +213,7 @@ void NavigationBar::aboutToShowHistoryNextMenu()
for (int i = curindex + 1; i < history->count(); i++) { for (int i = curindex + 1; i < history->count(); i++) {
QWebHistoryItem item = history->itemAt(i); QWebHistoryItem item = history->itemAt(i);
if (item.isValid() && lastUrl != item.url()) { if (item.isValid() && lastUrl != item.url()) {
QString title = item.title(); QString title = titleForUrl(item.title(), item.url());
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
Action* act = new Action(_iconForUrl(item.url()), title); Action* act = new Action(_iconForUrl(item.url()), title);
act->setData(i); act->setData(i);

View File

@ -34,6 +34,9 @@ SearchEnginesDialog::SearchEnginesDialog(QWidget* parent)
connect(ui->remove, SIGNAL(clicked()), this, SLOT(removeEngine())); connect(ui->remove, SIGNAL(clicked()), this, SLOT(removeEngine()));
connect(ui->edit, SIGNAL(clicked()), this, SLOT(editEngine())); connect(ui->edit, SIGNAL(clicked()), this, SLOT(editEngine()));
connect(ui->defaults, SIGNAL(clicked()), this, SLOT(defaults())); connect(ui->defaults, SIGNAL(clicked()), this, SLOT(defaults()));
connect(ui->moveUp, SIGNAL(clicked()), this, SLOT(moveUp()));
connect(ui->moveDown, SIGNAL(clicked()), this, SLOT(moveDown()));
connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(editEngine())); connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(editEngine()));
reloadEngines(); reloadEngines();
@ -124,6 +127,34 @@ void SearchEnginesDialog::defaults()
reloadEngines(); reloadEngines();
} }
void SearchEnginesDialog::moveUp()
{
QTreeWidgetItem* currentItem = ui->treeWidget->currentItem();
int index = ui->treeWidget->indexOfTopLevelItem(currentItem);
if (!currentItem || index == 0) {
return;
}
ui->treeWidget->takeTopLevelItem(index);
ui->treeWidget->insertTopLevelItem(index - 1, currentItem);
ui->treeWidget->setCurrentItem(currentItem);
}
void SearchEnginesDialog::moveDown()
{
QTreeWidgetItem* currentItem = ui->treeWidget->currentItem();
int index = ui->treeWidget->indexOfTopLevelItem(currentItem);
if (!currentItem || !ui->treeWidget->itemBelow(currentItem)) {
return;
}
ui->treeWidget->takeTopLevelItem(index);
ui->treeWidget->insertTopLevelItem(index + 1, currentItem);
ui->treeWidget->setCurrentItem(currentItem);
}
void SearchEnginesDialog::reloadEngines() void SearchEnginesDialog::reloadEngines()
{ {
ui->treeWidget->clear(); ui->treeWidget->clear();

View File

@ -42,6 +42,9 @@ private slots:
void removeEngine(); void removeEngine();
void editEngine(); void editEngine();
void moveUp();
void moveDown();
void defaults(); void defaults();
private: private:

View File

@ -51,24 +51,21 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="defaults"> <widget class="QPushButton" name="moveUp">
<property name="text"> <property name="text">
<string>Defaults</string> <string>Up</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="moveDown">
<property name="text">
<string>Down</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget"> <widget class="QTreeWidget" name="treeWidget">
<attribute name="headerDefaultSectionSize"> <attribute name="headerDefaultSectionSize">
@ -86,6 +83,46 @@
</column> </column>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="defaults">
<property name="text">
<string>Defaults</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -57,9 +57,9 @@ void AboutDialog::showAbout()
m_aboutHtml.append("<div style='margin:10px;'>"); m_aboutHtml.append("<div style='margin:10px;'>");
m_aboutHtml.append(tr("<p><b>Application version %1</b><br/>").arg(QupZilla::VERSION m_aboutHtml.append(tr("<p><b>Application version %1</b><br/>").arg(QupZilla::VERSION
#ifdef GIT_REVISION #ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")" + " (" + GIT_REVISION + ")"
#endif #endif
)); ));
m_aboutHtml.append(tr("<b>WebKit version %1</b></p>").arg(QupZilla::WEBKITVERSION)); m_aboutHtml.append(tr("<b>WebKit version %1</b></p>").arg(QupZilla::WEBKITVERSION));
m_aboutHtml.append(tr("<p>&copy; %1 %2<br/>All rights reserved.<br/>").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR)); m_aboutHtml.append(tr("<p>&copy; %1 %2<br/>All rights reserved.<br/>").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR));
m_aboutHtml.append(tr("<small>Build time: %1 </small></p>").arg(QupZilla::BUILDTIME)); m_aboutHtml.append(tr("<small>Build time: %1 </small></p>").arg(QupZilla::BUILDTIME));

View File

@ -117,12 +117,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
settings.endGroup(); settings.endGroup();
ui->afterLaunch->setCurrentIndex(afterLaunch); ui->afterLaunch->setCurrentIndex(afterLaunch);
ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates",
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
true true
#else #else
false false
#endif #endif
).toBool()); ).toBool());
ui->newTabFrame->setVisible(false); ui->newTabFrame->setVisible(false);
if (m_newTabUrl.isEmpty()) { if (m_newTabUrl.isEmpty()) {
@ -313,6 +313,9 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->useOSDNotifications->setChecked(true); ui->useOSDNotifications->setChecked(true);
} }
connect(ui->useNativeSystemNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
connect(ui->useOSDNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool()); ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool());
m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint(); m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint();
settings.endGroup(); settings.endGroup();
@ -389,21 +392,36 @@ void Preferences::showStackedPage(QListWidgetItem* item)
ui->caption->setText("<b>" + item->text() + "</b>"); ui->caption->setText("<b>" + item->text() + "</b>");
ui->stackedWidget->setCurrentIndex(item->whatsThis().toInt()); ui->stackedWidget->setCurrentIndex(item->whatsThis().toInt());
if (ui->stackedWidget->currentIndex() == 8) { setNotificationPreviewVisible(ui->stackedWidget->currentIndex() == 8);
m_notification = new DesktopNotification(true); }
m_notification.data()->setPixmap(QPixmap(":icons/preferences/stock_dialog-question.png"));
m_notification.data()->setHeading(tr("OSD Notification"));
m_notification.data()->setText(tr("Drag it on the screen to place it where you want."));
m_notification.data()->move(m_notifPosition);
m_notification.data()->show();
mApp->desktopNotifications()->nativeNotificationPreview(); void Preferences::setNotificationPreviewVisible(bool state)
} {
else if (m_notification.data()) { if (!state && m_notification.data()) {
m_notifPosition = m_notification.data()->pos(); m_notifPosition = m_notification.data()->pos();
delete m_notification.data(); delete m_notification.data();
} }
if (state) {
if (ui->useOSDNotifications->isChecked()) {
if (m_notification.data()) {
m_notifPosition = m_notification.data()->pos();
delete m_notification.data();
}
m_notification = new DesktopNotification(true);
m_notification.data()->setPixmap(QPixmap(":icons/preferences/stock_dialog-question.png"));
m_notification.data()->setHeading(tr("OSD Notification"));
m_notification.data()->setText(tr("Drag it on the screen to place it where you want."));
m_notification.data()->move(m_notifPosition);
m_notification.data()->show();
}
else if (ui->useNativeSystemNotifications->isChecked()) {
mApp->desktopNotifications()->nativeNotificationPreview();
}
}
} }
void Preferences::allowCacheChanged(bool state) void Preferences::allowCacheChanged(bool state)
{ {
ui->cacheFrame->setEnabled(state); ui->cacheFrame->setEnabled(state);

View File

@ -71,6 +71,8 @@ private slots:
void deleteProfile(); void deleteProfile();
void startProfileIndexChanged(QString index); void startProfileIndexChanged(QString index);
void setNotificationPreviewVisible(bool state);
private: private:
Ui::Preferences* ui; Ui::Preferences* ui;
QupZilla* p_QupZilla; QupZilla* p_QupZilla;

View File

@ -885,10 +885,10 @@ QString WebView::title() const
{ {
QString title = QWebView::title(); QString title = QWebView::title();
if (title.isEmpty()) { if (title.isEmpty()) {
title = url().host(); title = url().path();
} }
if (title.isEmpty()) { if (title.isEmpty()) {
title = url().path(); title = url().host();
} }
if (title.isEmpty()) { if (title.isEmpty()) {
return tr("No Named Page"); return tr("No Named Page");