summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/assistant.pro3
-rw-r--r--tools/assistant/tools/assistant/bookmarkdialog.cpp20
-rw-r--r--tools/assistant/tools/assistant/bookmarkdialog.h1
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp85
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.h8
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp321
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanagerwidget.h102
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanagerwidget.ui137
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.cpp25
-rw-r--r--tools/assistant/tools/assistant/bookmarkmodel.h1
-rw-r--r--tools/assistant/tools/assistant/bookmarkwidget.ui3
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp20
-rw-r--r--tools/assistant/tools/assistant/helpviewer.cpp45
-rw-r--r--tools/assistant/tools/assistant/helpviewer.h4
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.cpp62
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qtb.h2
-rw-r--r--tools/assistant/tools/assistant/helpviewer_qwv.cpp57
-rw-r--r--tools/designer/src/lib/shared/qtresourceview.cpp2
18 files changed, 730 insertions, 168 deletions
diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro
index 0733128..ff0ecc5 100644
--- a/tools/assistant/tools/assistant/assistant.pro
+++ b/tools/assistant/tools/assistant/assistant.pro
@@ -21,6 +21,7 @@ HEADERS += aboutdialog.h \
bookmarkfiltermodel.h \
bookmarkitem.h \
bookmarkmanager.h \
+ bookmarkmanagerwidget.h \
bookmarkmodel.h \
centralwidget.h \
cmdlineparser.h \
@@ -49,6 +50,7 @@ SOURCES += aboutdialog.cpp \
bookmarkfiltermodel.cpp \
bookmarkitem.cpp \
bookmarkmanager.cpp \
+ bookmarkmanagerwidget.cpp \
bookmarkmodel.cpp \
centralwidget.cpp \
cmdlineparser.cpp \
@@ -72,6 +74,7 @@ SOURCES += aboutdialog.cpp \
../shared/collectionconfiguration.cpp \
FORMS += bookmarkdialog.ui \
+ bookmarkmanagerwidget.ui \
bookmarkwidget.ui \
filternamedialog.ui \
installdialog.ui \
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.cpp b/tools/assistant/tools/assistant/bookmarkdialog.cpp
index c053b62..8b195c1 100644
--- a/tools/assistant/tools/assistant/bookmarkdialog.cpp
+++ b/tools/assistant/tools/assistant/bookmarkdialog.cpp
@@ -105,6 +105,11 @@ BookmarkDialog::~BookmarkDialog()
TRACE_OBJ
}
+bool BookmarkDialog::isRootItem(const QModelIndex &index) const
+{
+ return !bookmarkTreeModel->parent(index).isValid();
+}
+
bool BookmarkDialog::eventFilter(QObject *object, QEvent *event)
{
TRACE_OBJ
@@ -115,9 +120,12 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *event)
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
switch (ke->key()) {
case Qt::Key_F2: {
- bookmarkModel->setItemsEditable(true);
- ui.treeView->edit(ui.treeView->currentIndex());
- bookmarkModel->setItemsEditable(false);
+ const QModelIndex &index = ui.treeView->currentIndex();
+ if (!isRootItem(index)) {
+ bookmarkModel->setItemsEditable(true);
+ ui.treeView->edit(index);
+ bookmarkModel->setItemsEditable(false);
+ }
} break;
default: break;
}
@@ -212,13 +220,17 @@ void BookmarkDialog::textChanged(const QString& text)
void BookmarkDialog::customContextMenuRequested(const QPoint &point)
{
TRACE_OBJ
+ const QModelIndex &index = ui.treeView->currentIndex();
+ if (isRootItem(index))
+ return; // check if we go to rename the "Bookmarks Menu", bail
+
QMenu menu(QLatin1String(""), this);
QAction *renameItem = menu.addAction(tr("Rename Folder"));
QAction *picked = menu.exec(ui.treeView->mapToGlobal(point));
if (picked == renameItem) {
bookmarkModel->setItemsEditable(true);
- ui.treeView->edit(ui.treeView->currentIndex());
+ ui.treeView->edit(index);
bookmarkModel->setItemsEditable(false);
}
}
diff --git a/tools/assistant/tools/assistant/bookmarkdialog.h b/tools/assistant/tools/assistant/bookmarkdialog.h
index ba38c7a..e177af6 100644
--- a/tools/assistant/tools/assistant/bookmarkdialog.h
+++ b/tools/assistant/tools/assistant/bookmarkdialog.h
@@ -58,6 +58,7 @@ public:
~BookmarkDialog();
private:
+ bool isRootItem(const QModelIndex &index) const;
bool eventFilter(QObject *object, QEvent *event);
private slots:
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 8fba811..70f562e 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -41,6 +41,7 @@
#include "tracer.h"
#include "bookmarkmanager.h"
+#include "bookmarkmanagerwidget.h"
#include "bookmarkdialog.h"
#include "bookmarkfiltermodel.h"
#include "bookmarkitem.h"
@@ -48,15 +49,11 @@
#include "centralwidget.h"
#include "helpenginewrapper.h"
-#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QKeyEvent>
#include <QtGui/QMessageBox>
#include <QtGui/QSortFilterProxyModel>
-#include <QFile>
-#include "xbelsupport.h"
-
QT_BEGIN_NAMESPACE
// -- BookmarkManager::BookmarkWidget
@@ -163,6 +160,7 @@ BookmarkManager::BookmarkManager()
, bookmarkModel(new BookmarkModel)
, bookmarkWidget(new BookmarkWidget)
, bookmarkTreeView(new BookmarkTreeView)
+ , bookmarkManagerWidget(0)
{
TRACE_OBJ
bookmarkWidget->installEventFilter(this);
@@ -187,6 +185,10 @@ BookmarkManager::BookmarkManager()
connect(&HelpEngineWrapper::instance(), SIGNAL(setupFinished()), this,
SLOT(setupFinished()));
+ connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+ SLOT(refeshBookmarkMenu()));
+ connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+ SLOT(refeshBookmarkMenu()));
connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
SLOT(refeshBookmarkMenu()));
}
@@ -194,7 +196,9 @@ BookmarkManager::BookmarkManager()
BookmarkManager::~BookmarkManager()
{
TRACE_OBJ
+ delete bookmarkManagerWidget;
HelpEngineWrapper::instance().setBookmarks(bookmarkModel->bookmarks());
+ delete bookmarkModel;
}
void BookmarkManager::removeItem(const QModelIndex &index)
@@ -323,10 +327,8 @@ void BookmarkManager::setupFinished()
void BookmarkManager::addBookmark()
{
TRACE_OBJ
- if (CentralWidget *widget = CentralWidget::instance()) {
- showBookmarkDialog(widget->currentTitle(),
- widget->currentSource().toString());
- }
+ if (CentralWidget *widget = CentralWidget::instance())
+ addBookmark(widget->currentTitle(), widget->currentSource().toString());
}
void BookmarkManager::removeBookmark()
@@ -335,10 +337,21 @@ void BookmarkManager::removeBookmark()
removeItem(bookmarkTreeView->currentIndex());
}
-//void BookmarkManager::manageBookmarks()
-//{
-// TRACE_OBJ
-//}
+void BookmarkManager::manageBookmarks()
+{
+ TRACE_OBJ
+ if (bookmarkManagerWidget == 0) {
+ bookmarkManagerWidget = new BookmarkManagerWidget(bookmarkModel);
+ connect(bookmarkManagerWidget, SIGNAL(setSource(QUrl)), this,
+ SIGNAL(setSource(QUrl)));
+ connect(bookmarkManagerWidget, SIGNAL(setSourceInNewTab(QUrl))
+ , this, SIGNAL(setSourceInNewTab(QUrl)));
+ connect(bookmarkManagerWidget, SIGNAL(managerWidgetAboutToClose())
+ , this, SLOT(managerWidgetAboutToClose()));
+ }
+ bookmarkManagerWidget->show();
+ bookmarkManagerWidget->raise();
+}
void BookmarkManager::refeshBookmarkMenu()
{
@@ -348,10 +361,8 @@ void BookmarkManager::refeshBookmarkMenu()
bookmarkMenu->clear();
- //bookmarkMenu->addAction(tr("Manage Bookmarks..."), this,
- // SLOT(manageBookmarks()));
- bookmarkMenu->addAction(tr("Import..."), this, SLOT(importBookmarks()));
- bookmarkMenu->addAction(tr("Export..."), this, SLOT(exportBookmarks()));
+ bookmarkMenu->addAction(tr("Manage Bookmarks..."), this,
+ SLOT(manageBookmarks()));
bookmarkMenu->addAction(tr("Add Bookmark..."), this, SLOT(addBookmark()),
QKeySequence(tr("Ctrl+D")));
bookmarkMenu->addSeparator();
@@ -375,42 +386,6 @@ void BookmarkManager::renameBookmark(const QModelIndex &index)
bookmarkModel->setItemsEditable(false);
}
-void BookmarkManager::importBookmarks()
-{
- TRACE_OBJ
- const QString &fileName = QFileDialog::getOpenFileName(0, tr("Open File"),
- QDir::currentPath(), tr("Files (*.xbel)"));
-
- if (fileName.isEmpty())
- return;
-
- QFile file(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- XbelReader reader(bookmarkModel);
- reader.readFromFile(&file);
- }
-}
-
-void BookmarkManager::exportBookmarks()
-{
- TRACE_OBJ
- QString fileName = QFileDialog::getSaveFileName(0, tr("Save File"),
- QLatin1String("untitled.xbel"), tr("Files (*.xbel)"));
-
- const QLatin1String suffix(".xbel");
- if (!fileName.endsWith(suffix))
- fileName.append(suffix);
-
- QFile file(fileName);
- if (file.open(QIODevice::WriteOnly)) {
- XbelWriter writer(bookmarkModel);
- writer.writeToFile(&file);
- } else {
- QMessageBox::information(bookmarkTreeView, tr("Qt Assistant"),
- tr("Unable to save bookmarks."), tr("OK"));
- }
-}
-
void BookmarkManager::setSourceFromAction(QAction *action)
{
TRACE_OBJ
@@ -484,6 +459,12 @@ void BookmarkManager::focusInEvent()
bookmarkTreeView->setCurrentIndex(index);
}
+void BookmarkManager::managerWidgetAboutToClose()
+{
+ delete bookmarkManagerWidget;
+ bookmarkManagerWidget = 0;
+}
+
void BookmarkManager::textChanged(const QString &text)
{
TRACE_OBJ
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.h b/tools/assistant/tools/assistant/bookmarkmanager.h
index 88342d5..c26dad8 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.h
+++ b/tools/assistant/tools/assistant/bookmarkmanager.h
@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE
+class BookmarkManagerWidget;
class BookmarkModel;
class BookmarkFilterModel;
class QKeyEvent;
@@ -90,17 +91,15 @@ private slots:
void addBookmark();
void removeBookmark();
-// void manageBookmarks();
+ void manageBookmarks();
void refeshBookmarkMenu();
void renameBookmark(const QModelIndex &index);
- void importBookmarks();
- void exportBookmarks();
-
void setSourceFromAction(QAction *action);
void setSourceFromIndex(const QModelIndex &index, bool newTab = false);
void focusInEvent();
+ void managerWidgetAboutToClose();
void textChanged(const QString &text);
void customContextMenuRequested(const QPoint &point);
@@ -118,6 +117,7 @@ private:
BookmarkWidget *bookmarkWidget;
BookmarkTreeView *bookmarkTreeView;
+ BookmarkManagerWidget *bookmarkManagerWidget;
};
class BookmarkManager::BookmarkWidget : public QWidget
diff --git a/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp b/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp
new file mode 100644
index 0000000..65df6be
--- /dev/null
+++ b/tools/assistant/tools/assistant/bookmarkmanagerwidget.cpp
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bookmarkmanagerwidget.h"
+#include "bookmarkitem.h"
+#include "bookmarkmodel.h"
+#include "tracer.h"
+#include "xbelsupport.h"
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QUrl>
+
+#include <QtGui/QCloseEvent>
+#include <QtGui/QFileDialog>
+#include <QtGui/QKeySequence>
+#include <QtGui/QMessageBox>
+#include <QtGui/QShortcut>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+ #define TR(x) QCoreApplication::translate("BookmarkManager", x)
+}
+
+BookmarkManagerWidget::BookmarkManagerWidget(BookmarkModel *sourceModel,
+ QWidget *parent)
+ : QWidget(parent)
+ , bookmarkModel(sourceModel)
+{
+ TRACE_OBJ
+ ui.setupUi(this);
+
+ ui.treeView->setModel(bookmarkModel);
+
+ ui.treeView->expandAll();
+ ui.treeView->installEventFilter(this);
+ ui.treeView->viewport()->installEventFilter(this);
+ ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this,
+ SLOT(customContextMenuRequested(QPoint)));
+
+ connect(ui.remove, SIGNAL(clicked()), this, SLOT(removeItem()));
+ connect(ui.lineEdit, SIGNAL(textChanged(QString)), this,
+ SLOT(textChanged(QString)));
+ new QShortcut(QKeySequence::Find, ui.lineEdit, SLOT(setFocus()));
+
+ importExportMenu.addAction(tr("Import..."), this, SLOT(importBookmarks()));
+ importExportMenu.addAction(tr("Export..."), this, SLOT(exportBookmarks()));
+ ui.importExport->setMenu(&importExportMenu);
+
+ new QShortcut(QKeySequence::FindNext, this, SLOT(findNext()));
+ new QShortcut(QKeySequence::FindPrevious, this, SLOT(findPrevious()));
+
+ connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+ SLOT(refeshBookmarkCache()));
+ connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+ SLOT(refeshBookmarkCache()));
+ connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+ SLOT(refeshBookmarkCache()));
+
+ ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2)));
+}
+
+BookmarkManagerWidget::~BookmarkManagerWidget()
+{
+ TRACE_OBJ
+}
+
+void BookmarkManagerWidget::closeEvent(QCloseEvent *event)
+{
+ TRACE_OBJ
+ event->accept();
+ emit managerWidgetAboutToClose();
+}
+
+void BookmarkManagerWidget::renameItem(const QModelIndex &index)
+{
+ TRACE_OBJ
+ // check if we should rename the "Bookmarks Menu", bail
+ if (!bookmarkModel->parent(index).isValid())
+ return;
+
+ bookmarkModel->setItemsEditable(true);
+ ui.treeView->edit(index);
+ bookmarkModel->setItemsEditable(false);
+}
+
+static int nextIndex(int current, int count, bool forward)
+{
+ TRACE_OBJ
+ if (current >= 0)
+ return (forward ? (current + 1) : ((current - 1) + count)) % count;
+ return 0;
+}
+
+void BookmarkManagerWidget::selectNextIndex(bool direction) const
+{
+ QModelIndex current = ui.treeView->currentIndex();
+ if (current.isValid() && !cache.isEmpty()) {
+ current = cache.at(nextIndex(cache.indexOf(current), cache.count(),
+ direction));
+ }
+ ui.treeView->setCurrentIndex(current);
+}
+
+bool BookmarkManagerWidget::eventFilter(QObject *object, QEvent *event)
+{
+ TRACE_OBJ
+ if (object != ui.treeView && object != ui.treeView->viewport())
+ return QWidget::eventFilter(object, event);
+
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(event);
+ switch (ke->key()) {
+ case Qt::Key_F2: {
+ renameItem(ui.treeView->currentIndex());
+ } break;
+
+ case Qt::Key_Delete: {
+ removeItem(ui.treeView->currentIndex());
+ } break;
+
+ default: break;
+ }
+ }
+
+ if (event->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent *me = static_cast<QMouseEvent*>(event);
+ switch (me->button()) {
+ case Qt::LeftButton: {
+ if (me->modifiers() & Qt::ControlModifier)
+ setSourceFromIndex(ui.treeView->currentIndex(), true);
+ } break;
+
+ case Qt::MidButton: {
+ setSourceFromIndex(ui.treeView->currentIndex(), true);
+ } break;
+
+ default: break;
+ }
+ }
+ return QObject::eventFilter(object, event);
+}
+
+void BookmarkManagerWidget::findNext()
+{
+ TRACE_OBJ
+ selectNextIndex(true);
+}
+
+void BookmarkManagerWidget::findPrevious()
+{
+ TRACE_OBJ
+ selectNextIndex(false);
+}
+
+void BookmarkManagerWidget::importBookmarks()
+{
+ TRACE_OBJ
+ const QString &fileName = QFileDialog::getOpenFileName(0, TR("Open File"),
+ QDir::currentPath(), TR("Files (*.xbel)"));
+
+ if (fileName.isEmpty())
+ return;
+
+ QFile file(fileName);
+ if (file.open(QIODevice::ReadOnly)) {
+ XbelReader reader(bookmarkModel);
+ reader.readFromFile(&file);
+ }
+}
+
+void BookmarkManagerWidget::exportBookmarks()
+{
+ TRACE_OBJ
+ QString fileName = QFileDialog::getSaveFileName(0, TR("Save File"),
+ QLatin1String("untitled.xbel"), TR("Files (*.xbel)"));
+
+ const QLatin1String suffix(".xbel");
+ if (!fileName.endsWith(suffix))
+ fileName.append(suffix);
+
+ QFile file(fileName);
+ if (file.open(QIODevice::WriteOnly)) {
+ XbelWriter writer(bookmarkModel);
+ writer.writeToFile(&file);
+ } else {
+ QMessageBox::information(this, TR("Qt Assistant"),
+ TR("Unable to save bookmarks."), TR("OK"));
+ }
+}
+
+void BookmarkManagerWidget::refeshBookmarkCache()
+{
+ TRACE_OBJ
+ cache.clear();
+
+ const QString &text = ui.lineEdit->text();
+ if (!text.isEmpty())
+ cache = bookmarkModel->indexListFor(text);
+}
+
+void BookmarkManagerWidget::textChanged(const QString &/*text*/)
+{
+ TRACE_OBJ
+ refeshBookmarkCache();
+ if (!cache.isEmpty())
+ ui.treeView->setCurrentIndex(cache.at(0));
+}
+
+void BookmarkManagerWidget::removeItem(const QModelIndex &index)
+{
+ TRACE_OBJ
+ QModelIndex current = index.isValid() ? index : ui.treeView->currentIndex();
+ if (!bookmarkModel->parent(current).isValid())
+ return; // check if we should delete the "Bookmarks Menu", bail
+
+ if (bookmarkModel->hasChildren(current)) {
+ int value = QMessageBox::question(this, TR("Remove"), TR("You are going"
+ "to delete a Folder, this will also<br> remove it's content. Are "
+ "you sure to continue?"),
+ QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
+ if (value == QMessageBox::Cancel)
+ return;
+ }
+ bookmarkModel->removeItem(current);
+}
+
+void BookmarkManagerWidget::customContextMenuRequested(const QPoint &point)
+{
+ TRACE_OBJ
+ const QModelIndex &index = ui.treeView->indexAt(point);
+ if (!index.isValid())
+ return;
+
+ // check if we should open the menu on "Bookmarks Menu", bail
+ if (!bookmarkModel->parent(index).isValid())
+ return;
+
+ QAction *remove = 0;
+ QAction *rename = 0;
+ QAction *showItem = 0;
+ QAction *showItemInNewTab = 0;
+
+ QMenu menu(QLatin1String(""));
+ if (bookmarkModel->data(index, UserRoleFolder).toBool()) {
+ remove = menu.addAction(TR("Delete Folder"));
+ rename = menu.addAction(TR("Rename Folder"));
+ } else {
+ showItem = menu.addAction(TR("Show Bookmark"));
+ showItemInNewTab = menu.addAction(TR("Show Bookmark in New Tab"));
+ menu.addSeparator();
+ remove = menu.addAction(TR("Delete Bookmark"));
+ rename = menu.addAction(TR("Rename Bookmark"));
+ }
+
+ QAction *pickedAction = menu.exec(ui.treeView->mapToGlobal(point));
+ if (pickedAction == rename)
+ renameItem(index);
+ else if (pickedAction == remove)
+ removeItem(index);
+ else if (pickedAction == showItem || pickedAction == showItemInNewTab)
+ setSourceFromIndex(index, pickedAction == showItemInNewTab);
+}
+
+void
+BookmarkManagerWidget::setSourceFromIndex(const QModelIndex &index, bool newTab)
+{
+ TRACE_OBJ
+ if (bookmarkModel->data(index, UserRoleFolder).toBool())
+ return;
+
+ const QVariant &data = bookmarkModel->data(index, UserRoleUrl);
+ if (data.canConvert<QUrl>()) {
+ if (newTab)
+ emit setSourceInNewTab(data.toUrl());
+ else
+ emit setSource(data.toUrl());
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/bookmarkmanagerwidget.h b/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
new file mode 100644
index 0000000..94384a6
--- /dev/null
+++ b/tools/assistant/tools/assistant/bookmarkmanagerwidget.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BOOKMARKMANAGERWIDGET_H
+#define BOOKMARKMANAGERWIDGET_H
+
+#include "ui_bookmarkmanagerwidget.h"
+
+#include <QtCore/QPersistentModelIndex>
+
+#include <QtGui/QMenu>
+
+QT_BEGIN_NAMESPACE
+
+class BookmarkModel;
+class QCloseEvent;
+class QString;
+
+class BookmarkManagerWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ BookmarkManagerWidget(BookmarkModel *bookmarkModel, QWidget *parent = 0);
+ ~BookmarkManagerWidget();
+
+protected:
+ void closeEvent(QCloseEvent *event);
+
+signals:
+ void setSource(const QUrl &url);
+ void setSourceInNewTab(const QUrl &url);
+
+ void managerWidgetAboutToClose();
+
+private:
+ void renameItem(const QModelIndex &index);
+ void selectNextIndex(bool direction) const;
+ bool eventFilter(QObject *object, QEvent *event);
+
+private slots:
+ void findNext();
+ void findPrevious();
+
+ void importBookmarks();
+ void exportBookmarks();
+
+ void refeshBookmarkCache();
+ void textChanged(const QString &text);
+
+ void removeItem(const QModelIndex &index = QModelIndex());
+
+ void customContextMenuRequested(const QPoint &point);
+ void setSourceFromIndex(const QModelIndex &index, bool newTab = false);
+
+private:
+ QMenu importExportMenu;
+ Ui::BookmarkManagerWidget ui;
+ QList<QPersistentModelIndex> cache;
+
+ BookmarkModel *bookmarkModel;
+};
+
+QT_END_NAMESPACE
+
+#endif // BOOKMARKMANAGERWIDGET_H \ No newline at end of file
diff --git a/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui b/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui
new file mode 100644
index 0000000..dc965d9
--- /dev/null
+++ b/tools/assistant/tools/assistant/bookmarkmanagerwidget.ui
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BookmarkManagerWidget</class>
+ <widget class="QWidget" name="BookmarkManagerWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>517</width>
+ <height>348</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Manage Bookmarks</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <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="QLabel" name="label">
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTreeView" name="treeView">
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="showDropIndicator" stdset="0">
+ <bool>true</bool>
+ </property>
+ <property name="dragEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="autoExpandDelay">
+ <number>1000</number>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerDefaultSectionSize">
+ <number>225</number>
+ </attribute>
+ <attribute name="headerMinimumSectionSize">
+ <number>50</number>
+ </attribute>
+ <attribute name="headerDefaultSectionSize">
+ <number>225</number>
+ </attribute>
+ <attribute name="headerMinimumSectionSize">
+ <number>50</number>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="remove">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="importExport">
+ <property name="text">
+ <string>Import and Backup</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <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="pushButton_5">
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>pushButton_5</sender>
+ <signal>clicked()</signal>
+ <receiver>BookmarkManagerWidget</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>445</x>
+ <y>328</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>340</x>
+ <y>313</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.cpp b/tools/assistant/tools/assistant/bookmarkmodel.cpp
index c785f16..e446ff0 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmodel.cpp
@@ -79,6 +79,9 @@ BookmarkModel::bookmarks() const
void
BookmarkModel::setBookmarks(const QByteArray &bookmarks)
{
+ beginResetModel();
+
+ delete rootItem;
folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
bookmarkIcon = QIcon(QLatin1String(":/trolltech/assistant/images/bookmark.png"));
@@ -115,6 +118,8 @@ BookmarkModel::setBookmarks(const QByteArray &bookmarks)
setupCache(root);
cache.insert(static_cast<BookmarkItem*> (root.internalPointer()), root);
+
+ endResetModel();
}
void
@@ -220,9 +225,9 @@ BookmarkModel::flags(const QModelIndex &index) const
if (m_editable)
defaultFlags |= Qt::ItemIsEditable;
- if (itemFromIndex(index) && index.data(UserRoleFolder).toBool()
- && index.column() > 0) {
- defaultFlags &= ~Qt::ItemIsEditable;
+ if (itemFromIndex(index) && index.data(UserRoleFolder).toBool()) {
+ if (index.column() > 0)
+ return defaultFlags &~ Qt::ItemIsEditable;
return defaultFlags | Qt::ItemIsDropEnabled;
}
@@ -241,11 +246,13 @@ BookmarkModel::data(const QModelIndex &index, int role) const
return QLatin1String("");
return item->data(index.column());
} break;
+
case Qt::DecorationRole: {
if (index.column() == 0)
return index.data(UserRoleFolder).toBool()
? folderIcon : bookmarkIcon;
} break;
+
default:;
return item->data(role);
}
@@ -299,6 +306,18 @@ BookmarkModel::itemFromIndex(const QModelIndex &index) const
return rootItem;
}
+QList<QPersistentModelIndex>
+BookmarkModel::indexListFor(const QString &label) const
+{
+ QList<QPersistentModelIndex> hits;
+ const QModelIndexList &list = collectItems(QModelIndex());
+ foreach(const QModelIndex &index, list) {
+ if (index.data().toString().contains(label, Qt::CaseInsensitive))
+ hits.prepend(index); // list is reverse sorted
+ }
+ return hits;
+}
+
bool
BookmarkModel::insertRows(int position, int rows, const QModelIndex &parent)
{
diff --git a/tools/assistant/tools/assistant/bookmarkmodel.h b/tools/assistant/tools/assistant/bookmarkmodel.h
index 6b2a0b8..6469258 100644
--- a/tools/assistant/tools/assistant/bookmarkmodel.h
+++ b/tools/assistant/tools/assistant/bookmarkmodel.h
@@ -84,6 +84,7 @@ public:
QModelIndex indexFromItem(BookmarkItem *item) const;
BookmarkItem *itemFromIndex(const QModelIndex &index) const;
+ QList<QPersistentModelIndex> indexListFor(const QString &label) const;
bool insertRows(int position, int rows, const QModelIndex &parent);
bool removeRows(int position, int rows, const QModelIndex &parent);
diff --git a/tools/assistant/tools/assistant/bookmarkwidget.ui b/tools/assistant/tools/assistant/bookmarkwidget.ui
index 3015740..a31a277 100644
--- a/tools/assistant/tools/assistant/bookmarkwidget.ui
+++ b/tools/assistant/tools/assistant/bookmarkwidget.ui
@@ -14,6 +14,9 @@
<string>Bookmarks</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>4</number>
+ </property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index dd91326..f56e9e3 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -310,7 +310,7 @@ void CentralWidget::setLastShownPages()
{
TRACE_OBJ
HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
- const QStringList lastShownPageList = helpEngine.lastShownPages();
+ const QStringList &lastShownPageList = helpEngine.lastShownPages();
const int pageCount = lastShownPageList.count();
if (pageCount == 0) {
if (usesDefaultCollection)
@@ -333,9 +333,10 @@ void CentralWidget::setLastShownPages()
for (int curTab = 0; curTab < pageCount; ++curTab) {
const QString &curFile = lastShownPageList.at(curTab);
- if (helpEngine.findFile(curFile).isValid())
+ if (helpEngine.findFile(curFile).isValid()
+ || curFile == QLatin1String("about:blank")) {
setSourceInNewTab(curFile, zoomFactors.at(curTab).toFloat());
- else if (curTab + searchIsAttached <= tabToShow)
+ } else if (curTab + searchIsAttached <= tabToShow)
--tabToShow;
}
@@ -514,15 +515,12 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom)
{
TRACE_OBJ
- HelpViewer *viewer;
-
-#if defined(QT_NO_WEBKIT)
- viewer = currentHelpViewer();
- if (viewer && viewer->launchedWithExternalApp(url))
- return;
-#endif
+ if (HelpViewer *viewer = currentHelpViewer()) {
+ if (viewer->launchWithExternalApp(url))
+ return;
+ }
- viewer = new HelpViewer(this, zoom);
+ HelpViewer *viewer = new HelpViewer(this, zoom);
viewer->installEventFilter(this);
viewer->setSource(url);
viewer->setFocus(Qt::OtherFocusReason);
diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp
index 8597f6b..9b06400 100644
--- a/tools/assistant/tools/assistant/helpviewer.cpp
+++ b/tools/assistant/tools/assistant/helpviewer.cpp
@@ -39,13 +39,25 @@
**
****************************************************************************/
#include "helpviewer.h"
+#include "helpenginewrapper.h"
#include "tracer.h"
#include <QtCore/QCoreApplication>
+#include <QtCore/QFileInfo>
+#include <QtCore/QStringBuilder>
+#include <QtCore/QTemporaryFile>
#include <QtCore/QUrl>
+#include <QtGui/QDesktopServices>
+
QT_BEGIN_NAMESPACE
+QString AbstractHelpViewer::AboutBlank =
+ QCoreApplication::translate("HelpViewer", "<title>about:blank</title>");
+
+QString AbstractHelpViewer::LocalHelpFile = QLatin1String("qthelp://"
+ "com.trolltech.com.assistantinternal-1.0.0/assistant/assistant.html");
+
QString AbstractHelpViewer::PageNotFoundMessage =
QCoreApplication::translate("HelpViewer", "<title>Error 404...</title><div "
"align=\"center\"><br><br><h1>The page could not be found</h1><br><h3>'%1'"
@@ -76,7 +88,38 @@ bool AbstractHelpViewer::canOpenPage(const QString &url)
TRACE_OBJ
return url.endsWith(QLatin1String(".html"), Qt::CaseInsensitive)
|| url.endsWith(QLatin1String(".htm"), Qt::CaseInsensitive)
- || url == QLatin1String("blank");
+ || url == QLatin1String("about:blank");
+}
+
+bool AbstractHelpViewer::launchWithExternalApp(const QUrl &url)
+{
+ TRACE_OBJ
+ if (isLocalUrl(url)) {
+ const HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance();
+ const QUrl &resolvedUrl = helpEngine.findFile(url);
+ if (!resolvedUrl.isValid())
+ return false;
+
+ const QString& path = resolvedUrl.path();
+ if (!canOpenPage(path)) {
+ QTemporaryFile tmpTmpFile;
+ if (!tmpTmpFile.open())
+ return false;
+
+ const QString &extension = QFileInfo(path).completeSuffix();
+ QFile actualTmpFile(tmpTmpFile.fileName() % QLatin1String(".")
+ % extension);
+ if (!actualTmpFile.open(QIODevice::ReadWrite | QIODevice::Truncate))
+ return false;
+
+ actualTmpFile.write(helpEngine.fileData(resolvedUrl));
+ actualTmpFile.close();
+ return QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
+ }
+ } else if (url.scheme() == QLatin1String("http")) {
+ return QDesktopServices::openUrl(url);
+ }
+ return false;
}
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h
index fe860fd..0bfe904 100644
--- a/tools/assistant/tools/assistant/helpviewer.h
+++ b/tools/assistant/tools/assistant/helpviewer.h
@@ -64,9 +64,13 @@ public:
virtual void resetScale() = 0;
virtual qreal scale() const = 0;
+ static QString AboutBlank;
+ static QString LocalHelpFile;
static QString PageNotFoundMessage;
+
static bool isLocalUrl(const QUrl &url);
static bool canOpenPage(const QString &url);
+ static bool launchWithExternalApp(const QUrl &url);
};
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
index 1e439dc..bba2850 100644
--- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
#include "helpviewer_qtb.h"
-#include "helpviewer_qwv.h"
#if defined(QT_NO_WEBKIT)
@@ -47,15 +46,12 @@
#include "helpenginewrapper.h"
#include "tracer.h"
-#include <QtCore/QDir>
#include <QtCore/QStringBuilder>
#include <QtGui/QContextMenuEvent>
#include <QtGui/QMenu>
#include <QtGui/QClipboard>
#include <QtGui/QApplication>
-#include <QtGui/QMessageBox>
-#include <QtGui/QDesktopServices>
QT_BEGIN_NAMESPACE
@@ -136,62 +132,28 @@ void HelpViewer::resetScale()
void HelpViewer::setSource(const QUrl &url)
{
TRACE_OBJ
- bool help = url.toString() == QLatin1String("help");
- if (url.isValid() && !help) {
- if (launchedWithExternalApp(url))
+ const QString &string = url.toString();
+ if (url.isValid() && string != QLatin1String("help")) {
+ if (launchWithExternalApp(url))
return;
- QUrl u = helpEngine.findFile(url);
- if (u.isValid()) {
- QTextBrowser::setSource(u);
+ const QUrl &resolvedUrl = helpEngine.findFile(url);
+ if (resolvedUrl.isValid()) {
+ QTextBrowser::setSource(resolvedUrl);
return;
- }
+ }
}
- if (help) {
- QTextBrowser::setSource(QUrl(QLatin1String("qthelp://com.trolltech.com."
- "assistantinternal-1.0.0/assistant/assistant.html")));
- } else {
+ if (string != QLatin1String("help")) {
QTextBrowser::setSource(url);
- setHtml(PageNotFoundMessage.arg(url.toString()));
+ setHtml(string == QLatin1String("about:blank") ? AboutBlank
+ : PageNotFoundMessage.arg(url.toString()));
emit sourceChanged(url);
+ } else {
+ QTextBrowser::setSource(LocalHelpFile);
}
}
-bool HelpViewer::launchedWithExternalApp(const QUrl &url)
-{
- TRACE_OBJ
- const bool canOpen = canOpenPage(url.path());
- if (!isLocalUrl(url) || !canOpen) {
- bool launched = false;
- if (!canOpen && url.scheme() == QLatin1String("qthelp")) {
- const QString& path = url.path();
- const int lastDash = path.lastIndexOf(QChar('/'));
- QString fileName = QDir::tempPath() + QDir::separator();
- if (lastDash < 0)
- fileName += path;
- else
- fileName += path.mid(lastDash + 1, path.length());
-
- QFile tmpFile(QDir::cleanPath(fileName));
- if (tmpFile.open(QIODevice::ReadWrite)) {
- tmpFile.write(helpEngine.fileData(url));
- tmpFile.close();
- }
- launched = QDesktopServices::openUrl(QUrl(tmpFile.fileName()));
- } else {
- launched = QDesktopServices::openUrl(url);
- }
-
- if (!launched) {
- QMessageBox::information(this, tr("Help"),
- tr("Unable to launch external application.\n"), tr("OK"));
- }
- return true;
- }
- return false;
-}
-
QVariant HelpViewer::loadResource(int type, const QUrl &name)
{
TRACE_OBJ
diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h
index 2d29774..5b38870 100644
--- a/tools/assistant/tools/assistant/helpviewer_qtb.h
+++ b/tools/assistant/tools/assistant/helpviewer_qtb.h
@@ -81,8 +81,6 @@ public:
inline bool hasSelection() const
{ return textCursor().hasSelection(); }
- bool launchedWithExternalApp(const QUrl &url);
-
public Q_SLOTS:
void home();
diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
index e302b5e..9bb66e1 100644
--- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp
+++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp
@@ -50,10 +50,8 @@
#include <QtCore/QFileInfo>
#include <QtCore/QString>
#include <QtCore/QStringBuilder>
-#include <QtCore/QTemporaryFile>
#include <QtCore/QTimer>
-#include <QtGui/QDesktopServices>
#include <QtGui/QWheelEvent>
#include <QtNetwork/QNetworkAccessManager>
@@ -212,45 +210,27 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
const QNetworkRequest &request, QWebPage::NavigationType type)
{
TRACE_OBJ
- const QUrl &url = request.url();
const bool closeNewTab = closeNewTabIfNeeded;
closeNewTabIfNeeded = false;
- if (AbstractHelpViewer::isLocalUrl(url)) {
- const QString& path = url.path();
- if (!AbstractHelpViewer::canOpenPage(path)) {
- QTemporaryFile tmpTmpFile;
- if (!tmpTmpFile.open())
- return false;
- const QString &extension = QFileInfo(path).completeSuffix();
- QFile actualTmpFile(tmpTmpFile.fileName() % QLatin1String(".")
- % extension);
- if (actualTmpFile.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
- actualTmpFile.write(HelpEngineWrapper::instance().fileData(url));
- actualTmpFile.close();
- QDesktopServices::openUrl(QUrl(actualTmpFile.fileName()));
- }
-
- if (closeNewTab)
- QMetaObject::invokeMethod(CentralWidget::instance(), "closeTab");
+ const QUrl &url = request.url();
+ if (AbstractHelpViewer::launchWithExternalApp(url)) {
+ if (closeNewTab)
+ QMetaObject::invokeMethod(centralWidget, "closeTab");
+ return false;
+ }
+
+ if (type == QWebPage::NavigationTypeLinkClicked
+ && (m_keyboardModifiers & Qt::ControlModifier
+ || m_pressedButtons == Qt::MidButton)) {
+ if (HelpViewer* viewer = centralWidget->newEmptyTab())
+ centralWidget->setSource(url);
+ m_pressedButtons = Qt::NoButton;
+ m_keyboardModifiers = Qt::NoModifier;
return false;
- }
-
- if (type == QWebPage::NavigationTypeLinkClicked
- && (m_keyboardModifiers & Qt::ControlModifier
- || m_pressedButtons == Qt::MidButton)) {
- HelpViewer* viewer = centralWidget->newEmptyTab();
- if (viewer)
- CentralWidget::instance()->setSource(url);
- m_pressedButtons = Qt::NoButton;
- m_keyboardModifiers = Qt::NoModifier;
- return false;
- }
- return true;
}
- QDesktopServices::openUrl(url);
- return false;
+ return true;
}
// -- HelpViewer
@@ -338,12 +318,7 @@ void HelpViewer::setSource(const QUrl &url)
{
TRACE_OBJ
loadFinished = false;
- if (url.toString() == QLatin1String("help")) {
- load(QUrl(QLatin1String("qthelp://com.trolltech.com."
- "assistantinternal-1.0.0/assistant/assistant.html")));
- } else {
- load(url);
- }
+ load(url.toString() == QLatin1String("help") ? LocalHelpFile : url);
}
void HelpViewer::home()
diff --git a/tools/designer/src/lib/shared/qtresourceview.cpp b/tools/designer/src/lib/shared/qtresourceview.cpp
index c15942f..859f239 100644
--- a/tools/designer/src/lib/shared/qtresourceview.cpp
+++ b/tools/designer/src/lib/shared/qtresourceview.cpp
@@ -664,6 +664,8 @@ QString QtResourceView::selectedResource() const
void QtResourceView::selectResource(const QString &resource)
{
+ if (resource.isEmpty())
+ return;
QFileInfo fi(resource);
QDir dir = fi.absoluteDir();
if (fi.isDir())