From f3d3fb6041a870901ba5cf36fb49d46e577cf0d1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Jun 2009 19:08:00 +0200 Subject: Removed unuseful history dialog. We use just history panel, from now on.. --- src/CMakeLists.txt | 1 - src/history.cpp | 2 +- src/history.ui | 74 ----------------------------- src/historydialog.cpp | 129 -------------------------------------------------- src/historydialog.h | 57 ---------------------- src/historymenu.cpp | 11 +---- src/historymenu.h | 1 - 7 files changed, 2 insertions(+), 273 deletions(-) delete mode 100644 src/history.ui delete mode 100644 src/historydialog.cpp delete mode 100644 src/historydialog.h (limited to 'src') 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 @@ - - - historyWidget - - - - 0 - 0 - 584 - 381 - - - - - - - - - &Remove - - - - - - - Remove &All - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Search: - - - - - - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - EditTreeView - QTreeView -
edittreeview.h
-
-
- - -
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 -* -* -* 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 -#include - -// Qt Includes -#include - -#include -#include -#include - - -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 -* -* -* 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 - -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 #include @@ -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 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; -- cgit v1.2.1