diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/history.cpp | 2 | ||||
-rw-r--r-- | src/history.ui | 74 | ||||
-rw-r--r-- | src/historydialog.cpp | 129 | ||||
-rw-r--r-- | src/historydialog.h | 57 | ||||
-rw-r--r-- | src/historymenu.cpp | 11 | ||||
-rw-r--r-- | src/historymenu.h | 1 |
7 files changed, 2 insertions, 273 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 92fd9d53..8660e674 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,6 @@ SET( rekonq_SRCS edittableview.cpp edittreeview.cpp history.cpp - historydialog.cpp historymenu.cpp bookmarks.cpp modelmenu.cpp diff --git a/src/history.cpp b/src/history.cpp index dcfe4c21..11cd3653 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -540,7 +540,7 @@ bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent) // ----------------------------------------------------------------------------------------------- -#define MOVEDROWS 10 +#define MOVEDROWS 20 /* diff --git a/src/history.ui b/src/history.ui deleted file mode 100644 index 1f3e1016..00000000 --- a/src/history.ui +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>historyWidget</class> - <widget class="QWidget" name="Form"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>584</width> - <height>381</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout"> - <item> - <widget class="QPushButton" name="removeButton"> - <property name="text"> - <string>&Remove</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeAllButton"> - <property name="text"> - <string>Remove &All</string> - </property> - </widget> - </item> - <item> - <spacer> - <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="QLabel" name="label"> - <property name="text"> - <string>Search:</string> - </property> - </widget> - </item> - <item> - <widget class="KLineEdit" name="search"/> - </item> - </layout> - </item> - <item> - <widget class="EditTreeView" name="tree"/> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KLineEdit</class> - <extends>QLineEdit</extends> - <header>klineedit.h</header> - </customwidget> - <customwidget> - <class>EditTreeView</class> - <extends>QTreeView</extends> - <header>edittreeview.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/historydialog.cpp b/src/historydialog.cpp deleted file mode 100644 index 6a150952..00000000 --- a/src/historydialog.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* -* -* This program is free software; you can redistribute it -* and/or modify it under the terms of the GNU General -* Public License as published by the Free Software Foundation; -* either version 3, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* ============================================================ */ - - -// Auto Includes -#include "historydialog.h" -#include "historydialog.moc" - -// Local Includes -#include "history.h" -#include "application.h" - -// KDE Includes -#include <KAction> -#include <KUrl> - -// Qt Includes -#include <QtCore/QPoint> - -#include <QtGui/QWidget> -#include <QtGui/QClipboard> -#include <QtGui/QDesktopWidget> - - -HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) - : KDialog(parent) - , m_historyWidg(new Ui::historyWidget) -{ - HistoryManager *history = setHistory; - if (!history) - history = Application::historyManager(); - - setCaption( i18n("History") ); - setButtons( KDialog::Close ); - - QWidget *widget = new QWidget; - m_historyWidg->setupUi(widget); - setMainWidget(widget); - - m_historyWidg->search->setClearButtonShown(true); - - m_historyWidg->tree->setUniformRowHeights(true); - m_historyWidg->tree->setSelectionBehavior(QAbstractItemView::SelectRows); - m_historyWidg->tree->setTextElideMode(Qt::ElideMiddle); - - QAbstractItemModel *model = history->historyTreeModel(); - TreeProxyModel *proxyModel = new TreeProxyModel(this); - - connect(m_historyWidg->search, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString))); - connect(m_historyWidg->removeButton, SIGNAL(clicked()), m_historyWidg->tree, SLOT(removeOne())); - connect(m_historyWidg->removeAllButton, SIGNAL(clicked()), history, SLOT(clear())); - - proxyModel->setSourceModel(model); - m_historyWidg->tree->setModel(proxyModel); - m_historyWidg->tree->setExpanded(proxyModel->index(0, 0), true); - m_historyWidg->tree->setAlternatingRowColors(true); - - QFontMetrics fm(font()); - int header = fm.width(QLatin1Char('m')) * 25; - m_historyWidg->tree->header()->resizeSection(0, header); - m_historyWidg->tree->header()->setStretchLastSection(true); - - m_historyWidg->tree->setContextMenuPolicy(Qt::CustomContextMenu); - - connect(m_historyWidg->tree, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(customContextMenuRequested(const QPoint &))); - - connect(m_historyWidg->tree, SIGNAL(activated(const QModelIndex&)), this, SLOT(open())); -} - - -void HistoryDialog::customContextMenuRequested(const QPoint &pos) -{ - KMenu menu; - QModelIndex index = m_historyWidg->tree->indexAt(pos); - index = index.sibling(index.row(), 0); - if (index.isValid() && !m_historyWidg->tree->model()->hasChildren(index)) - { - menu.addAction(i18n("Open"), this, SLOT(open())); - menu.addSeparator(); - menu.addAction(i18n("Copy"), this, SLOT(copy())); - } - menu.addAction(i18n("Delete"), m_historyWidg->tree, SLOT(removeOne())); - menu.exec(QCursor::pos()); -} - - -void HistoryDialog::open() -{ - QModelIndex index = m_historyWidg->tree->currentIndex(); - if (!index.parent().isValid()) - return; - emit openUrl(index.data(HistoryModel::UrlRole).toUrl()); -} - - -void HistoryDialog::copy() -{ - QModelIndex index = m_historyWidg->tree->currentIndex(); - if (!index.parent().isValid()) - return; - QString url = index.data(HistoryModel::UrlStringRole).toString(); - - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(url); -} - -QSize HistoryDialog::sizeHint() const -{ - QRect desktopRect = Application::desktop()->screenGeometry(); - QSize size = desktopRect.size() * 0.7; - return size; -} diff --git a/src/historydialog.h b/src/historydialog.h deleted file mode 100644 index 20f92d9d..00000000 --- a/src/historydialog.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* -* -* This program is free software; you can redistribute it -* and/or modify it under the terms of the GNU General -* Public License as published by the Free Software Foundation; -* either version 3, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* ============================================================ */ - - - -#ifndef HISTORYDIALOG_H -#define HISTORYDIALOG_H - - -// Ui includes -#include "ui_history.h" - -// KDE Includes -#include <KDialog> - -class KUrl; -class QPoint; -class QWidget; -class HistoryManager; - -class HistoryDialog : public KDialog -{ - Q_OBJECT - -signals: - void openUrl(const KUrl &url); - -public: - explicit HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0); - QSize sizeHint() const; - -private slots: - void customContextMenuRequested(const QPoint &pos); - void open(); - void copy(); - -private: - Ui::historyWidget *m_historyWidg; -}; - -#endif diff --git a/src/historymenu.cpp b/src/historymenu.cpp index 234236ac..df8bb756 100644 --- a/src/historymenu.cpp +++ b/src/historymenu.cpp @@ -23,7 +23,6 @@ #include "historymenu.moc" #include "application.h" -#include "historydialog.h" #include <QtGui/QWidget> #include <QtCore/QModelIndex> @@ -70,7 +69,7 @@ void HistoryMenu::postPopulated() addSeparator(); KAction *showAllAction = new KAction(i18n("Show All History"), this); - connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); +// connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); addAction(showAllAction); KAction *clearAction = new KAction(i18n("Clear History"), this); @@ -79,14 +78,6 @@ void HistoryMenu::postPopulated() } -void HistoryMenu::showHistoryDialog() -{ - HistoryDialog *dialog = new HistoryDialog(this); - connect(dialog, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&))); - dialog->show(); -} - - void HistoryMenu::setInitialActions(QList<QAction*> actions) { m_initialActions = actions; diff --git a/src/historymenu.h b/src/historymenu.h index ec529b65..f0c16d22 100644 --- a/src/historymenu.h +++ b/src/historymenu.h @@ -54,7 +54,6 @@ protected: private slots: void activated(const QModelIndex &index); - void showHistoryDialog(); private: HistoryManager *m_history; |