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

[Code] Small changes in showing context menu in url and searchbar

- may fix occasional crashes in Ubuntu
This commit is contained in:
nowrep 2012-10-11 19:57:12 +02:00
parent 288d2caafe
commit ba84fa2d7a
4 changed files with 14 additions and 21 deletions

View File

@ -49,7 +49,6 @@ LocationBar::LocationBar(QupZilla* mainClass)
: LineEdit(mainClass)
, p_QupZilla(mainClass)
, m_webView(0)
, m_menu(new QMenu(this))
, m_pasteAndGoAction(0)
, m_clearAction(0)
, m_holdingAlt(false)
@ -324,13 +323,11 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
}
QMenu* tempMenu = createStandardContextMenu();
m_menu->clear();
QMenu menu(this);
int i = 0;
foreach(QAction * act, tempMenu->actions()) {
act->setParent(m_menu);
tempMenu->removeAction(act);
m_menu->addAction(act);
menu.addAction(act);
switch (i) {
case 0:
@ -347,13 +344,13 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
break;
case 5:
act->setIcon(QIcon::fromTheme("edit-paste"));
m_menu->addAction(act);
m_menu->addAction(m_pasteAndGoAction);
menu.addAction(act);
menu.addAction(m_pasteAndGoAction);
break;
case 6:
act->setIcon(QIcon::fromTheme("edit-delete"));
m_menu->addAction(act);
m_menu->addAction(m_clearAction);
menu.addAction(act);
menu.addAction(m_clearAction);
break;
case 8:
act->setIcon(QIcon::fromTheme("edit-select-all"));
@ -362,14 +359,14 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
++i;
}
tempMenu->deleteLater();
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
//Prevent choosing first option with double rightclick
// Prevent choosing first option with double rightclick
QPoint pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p);
menu.exec(p);
tempMenu->deleteLater();
}
void LocationBar::focusInEvent(QFocusEvent* event)
@ -595,7 +592,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
{
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
LineEdit::paintEvent(event);
if(m_forceLineEditPaintEvent) {
if (m_forceLineEditPaintEvent) {
m_forceLineEditPaintEvent = false;
update();
}

View File

@ -115,7 +115,6 @@ private:
QupZilla* p_QupZilla;
TabbedWebView* m_webView;
QMenu* m_menu;
QAction* m_pasteAndGoAction;
QAction* m_clearAction;

View File

@ -303,8 +303,6 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
++i;
}
tempMenu->deleteLater();
menu.addSeparator();
QAction* act = menu.addAction(tr("Show suggestions"));
act->setCheckable(true);
@ -318,10 +316,12 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
//Prevent choosing first option with double rightclick
// Prevent choosing first option with double rightclick
QPoint pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
tempMenu->deleteLater();
}
void WebSearchBar::focusOutEvent(QFocusEvent* e)

View File

@ -70,9 +70,6 @@ $translating_moreinfo = "Więcej informacji o tłumaczeniu <a href='https://gith
$creators = "Kto tworzy QupZillę?";
$creators_text = "Właścicielem projektu i głównym programistą jest student z Republiki Czeskiej, <b>David Rosca</b> (nowrep).<br/>
Poza kodowaniem, użytkownicy współtworzą tłumaczenia na wiele języków i wspierają QupZillę. Lista osób współtworzących dostępna jest <a href='https://github.com/QupZilla/qupzilla/blob/master/AUTHORS'>tutaj</a> [github].<br/><br/>Możesz także dołączyć do kanału IRC <b>#qupzilla</b> w sieci irc.freenode.net aby porozmawiać z osobami zaangażowanymi w rozwój QupZilli.";
// You can delete these (commented) lines after you translate $creators and $creators_text
//$contributors = "Contributors";
//$contributors_text = "Full list of contributors can be found on <a href='https://github.com/nowrep/QupZilla/blob/master/AUTHORS'>github</a>.<br/>You can also join IRC channel #qupzilla at irc.freenode.net.";
$share_with_friends = "Podziel się ze znajomymi!";
$share_with_friends_text = "Lubisz QupZillę? W takim razie podziel się nią ze swoimi znajomymi!";
?>