mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
The 'bookmarkswidget' was improved.
This commit is contained in:
parent
4144921aa9
commit
7e7f914f74
@ -47,7 +47,7 @@ BookmarkIcon::BookmarkIcon(QupZilla* mainClass, QWidget* parent)
|
||||
|
||||
void BookmarkIcon::iconClicked()
|
||||
{
|
||||
BookmarksWidget* menu = new BookmarksWidget(p_QupZilla->weView(), p_QupZilla->locationBar());
|
||||
BookmarksWidget* menu = new BookmarksWidget(p_QupZilla, p_QupZilla->weView(), p_QupZilla->locationBar());
|
||||
menu->showAt(this);
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,15 @@
|
||||
#include "pluginproxy.h"
|
||||
#include "speeddial.h"
|
||||
#include "webview.h"
|
||||
#include "qupzilla.h"
|
||||
|
||||
#include <QToolTip>
|
||||
#include <QSqlQuery>
|
||||
|
||||
BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
|
||||
BookmarksWidget::BookmarksWidget(QupZilla *mainClass, WebView* view, QWidget* parent)
|
||||
: QMenu(parent)
|
||||
, ui(new Ui::BookmarksWidget)
|
||||
, p_QupZilla(mainClass)
|
||||
, m_url(view->url())
|
||||
, m_view(view)
|
||||
, m_bookmarksModel(mApp->bookmarksModel())
|
||||
@ -36,17 +38,18 @@ BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// The locationbar's direction is direction of its text,
|
||||
// it dynamically changes and so, it's not good choice for this widget.
|
||||
setLayoutDirection(QApplication::layoutDirection());
|
||||
|
||||
connect(ui->close, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(ui->removeBookmark, SIGNAL(clicked()), this, SLOT(removeBookmark()));
|
||||
connect(ui->save, SIGNAL(clicked()), this, SLOT(saveBookmark()));
|
||||
|
||||
connect(ui->bookmarksButton, SIGNAL(clicked()), this, SLOT(addBookmark()));
|
||||
connect(ui->organizeBookmarksButton, SIGNAL(clicked()), p_QupZilla, SLOT(showBookmarksManager()));
|
||||
connect(ui->speeddialButton, SIGNAL(clicked()), this, SLOT(toggleSpeedDial()));
|
||||
|
||||
if (m_bookmarksModel->isBookmarked(m_url)) {
|
||||
ui->bookmarksButton->setText(tr("Edit Bookmark"));
|
||||
}
|
||||
|
||||
const SpeedDial::Page &page = m_speedDial->pageForUrl(m_url);
|
||||
ui->speeddialButton->setText(page.url.isEmpty() ? tr("Add to Speed Dial") : tr("Remove from Speed Dial"));
|
||||
|
||||
@ -57,13 +60,13 @@ BookmarksWidget::BookmarksWidget(WebView* view, QWidget* parent)
|
||||
ui->label_2->setPalette(pal);
|
||||
ui->label_3->setPalette(pal);
|
||||
#endif
|
||||
|
||||
addBookmark();
|
||||
}
|
||||
|
||||
void BookmarksWidget::loadBookmark()
|
||||
{
|
||||
if (m_bookmarksModel->isBookmarked(m_url)) {
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
|
||||
m_bookmarkId = m_bookmarksModel->bookmarkId(m_url);
|
||||
BookmarksModel::Bookmark bookmark = m_bookmarksModel->getBookmark(m_bookmarkId);
|
||||
ui->name->setText(bookmark.title);
|
||||
|
@ -31,11 +31,13 @@ class BookmarksWidget;
|
||||
class WebView;
|
||||
class SpeedDial;
|
||||
class BookmarksModel;
|
||||
class QupZilla;
|
||||
|
||||
class QT_QUPZILLA_EXPORT BookmarksWidget : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BookmarksWidget(WebView* view, QWidget* parent = 0);
|
||||
explicit BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* parent = 0);
|
||||
~BookmarksWidget();
|
||||
void showAt(QWidget* _parent);
|
||||
|
||||
@ -57,6 +59,7 @@ private:
|
||||
Ui::BookmarksWidget* ui;
|
||||
QUrl m_url;
|
||||
int m_bookmarkId;
|
||||
QupZilla* p_QupZilla;
|
||||
|
||||
WebView* m_view;
|
||||
BookmarksModel* m_bookmarksModel;
|
||||
|
@ -7,169 +7,139 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>275</width>
|
||||
<height>98</height>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Frame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="speeddialButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add to Speed Dial</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="organizeBookmarksButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Organize Bookmarks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="name"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="folder">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="folder"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="name"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeBookmark">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</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="QPushButton" name="save">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="close">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="bookmarksButton">
|
||||
<property name="text">
|
||||
<string>Add to Bookmarks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="speeddialButton">
|
||||
<property name="text">
|
||||
<string>Add to Speed Dial</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeBookmark">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</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="QPushButton" name="save">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="close">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Frame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>frame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../data/icons.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user