summaryrefslogtreecommitdiffstats
path: root/tools/assistant
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2009-12-12 06:50:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2009-12-12 06:50:55 (GMT)
commitb1906f053ec1a9c90c4df1870568e3036fae6b9b (patch)
tree09d595ad5e698561f7b094dab2983bed350ec7c6 /tools/assistant
parent1860aa75013a4d91b553c9dadf8130cc06a96641 (diff)
parentdacbb8b055815f629e2eeccdb7d4ca4cc5a2f839 (diff)
downloadQt-b1906f053ec1a9c90c4df1870568e3036fae6b9b.zip
Qt-b1906f053ec1a9c90c4df1870568e3036fae6b9b.tar.gz
Qt-b1906f053ec1a9c90c4df1870568e3036fae6b9b.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1 into qt-integration
* '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1: Update Polish translations Assistant: Add documentation for -remove-search-index. Designer: Handle "visible"-properties of item view headers correctly. Fix .gitignore to not ignore qdoc.pro Update polish translations Fix broken delete key, some cleanup. Assistant: Fix race condition in index creation. Don't forget to append current $MAC_CONFIG_TEST_COMMANDLINE when setting the SDK to use.
Diffstat (limited to 'tools/assistant')
-rw-r--r--tools/assistant/lib/qhelpindexwidget.cpp4
-rw-r--r--tools/assistant/tools/assistant/bookmarkmanager.cpp116
2 files changed, 69 insertions, 51 deletions
diff --git a/tools/assistant/lib/qhelpindexwidget.cpp b/tools/assistant/lib/qhelpindexwidget.cpp
index 475a1fe..6cf1a72 100644
--- a/tools/assistant/lib/qhelpindexwidget.cpp
+++ b/tools/assistant/lib/qhelpindexwidget.cpp
@@ -130,6 +130,7 @@ void QHelpIndexProvider::stopCollecting()
m_abort = true;
m_mutex.unlock();
wait();
+ m_abort = false;
}
QStringList QHelpIndexProvider::indices() const
@@ -164,7 +165,6 @@ void QHelpIndexProvider::run()
foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) {
m_mutex.lock();
if (m_abort) {
- m_abort = false;
m_mutex.unlock();
return;
}
@@ -181,7 +181,6 @@ void QHelpIndexProvider::run()
foreach (QString s, lst)
indicesSet.insert(s);
if (m_abort) {
- m_abort = false;
m_mutex.unlock();
return;
}
@@ -194,7 +193,6 @@ void QHelpIndexProvider::run()
m_mutex.lock();
m_indices = indicesSet.values();
qSort(m_indices.begin(), m_indices.end(), caseInsensitiveLessThan);
- m_abort = false;
m_mutex.unlock();
}
diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp
index 70f3157..523525e 100644
--- a/tools/assistant/tools/assistant/bookmarkmanager.cpp
+++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp
@@ -69,9 +69,12 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
, m_title(title)
, bookmarkManager(manager)
{
+ ui.setupUi(this);
+
installEventFilter(this);
+ ui.treeView->installEventFilter(this);
+ ui.treeView->viewport()->installEventFilter(this);
- ui.setupUi(this);
ui.bookmarkEdit->setText(title);
ui.newFolderButton->setVisible(false);
ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
@@ -264,12 +267,14 @@ void BookmarkDialog::currentChanged(const QModelIndex &current)
bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
{
- if (object == this && e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+ if (object != ui.treeView && object != ui.treeView->viewport())
+ return QWidget::eventFilter(object, e);
- QModelIndex index = ui.treeView->currentIndex();
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(e);
switch (ke->key()) {
case Qt::Key_F2: {
+ const QModelIndex &index = ui.treeView->currentIndex();
const QModelIndex &source = proxyModel->mapToSource(index);
QStandardItem *item =
bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
@@ -281,13 +286,13 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
} break;
case Qt::Key_Delete: {
+ const QModelIndex &index = ui.treeView->currentIndex();
bookmarkManager->removeBookmarkItem(ui.treeView,
proxyModel->mapToSource(index));
ui.bookmarkFolders->clear();
ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
QString name = tr("Bookmarks");
- index = ui.treeView->currentIndex();
if (index.isValid())
name = index.data().toString();
ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
@@ -297,6 +302,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
break;
}
}
+
return QObject::eventFilter(object, e);
}
@@ -312,7 +318,10 @@ BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent,
, bookmarkManager(manager)
{
setup(showButtons);
+
installEventFilter(this);
+ treeView->installEventFilter(this);
+ treeView->viewport()->installEventFilter(this);
}
BookmarkWidget::~BookmarkWidget()
@@ -484,7 +493,6 @@ void BookmarkWidget::setup(bool showButtons)
treeView->setAutoExpandDelay(1000);
treeView->setDropIndicatorShown(true);
treeView->header()->setVisible(false);
- treeView->viewport()->installEventFilter(this);
treeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeView, SIGNAL(expanded(QModelIndex)), this,
@@ -530,59 +538,71 @@ void BookmarkWidget::focusInEvent(QFocusEvent *e)
bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
{
- if ((object == this) || (object == treeView->viewport())) {
- QModelIndex index = treeView->currentIndex();
- if (e->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(e);
- if (index.isValid() && searchField->text().isEmpty()) {
+ if (object != this && object != treeView
+ && object != treeView->viewport()) {
+ return QWidget::eventFilter(object, e);
+ }
+
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent *ke = static_cast<QKeyEvent*>(e);
+ const bool tree = object == treeView || object == treeView->viewport();
+ switch (ke->key()) {
+ case Qt::Key_F2: {
+ const QModelIndex &index = treeView->currentIndex();
const QModelIndex &src = filterBookmarkModel->mapToSource(index);
- if (ke->key() == Qt::Key_F2) {
- QStandardItem *item =
- bookmarkManager->treeBookmarkModel()->itemFromIndex(src);
- if (item) {
+ if (tree && searchField->text().isEmpty()) {
+ if (QStandardItem *item = bookmarkManager->treeBookmarkModel()
+ ->itemFromIndex(src)) {
item->setEditable(true);
treeView->edit(index);
item->setEditable(false);
}
- } else if (ke->key() == Qt::Key_Delete) {
- bookmarkManager->removeBookmarkItem(treeView, src);
}
- }
+ } break;
+
+ case Qt::Key_Enter: {
+ case Qt::Key_Return:
+ if (tree) {
+ const QString &data = treeView->selectionModel()->currentIndex()
+ .data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ emit requestShowLink(data);
+ }
+ } break;
- switch (ke->key()) {
- default: break;
- case Qt::Key_Up: {
- case Qt::Key_Down:
+ case Qt::Key_Delete: {
+ const QModelIndex &index = treeView->currentIndex();
+ const QModelIndex &src = filterBookmarkModel->mapToSource(index);
+ if (tree && searchField->text().isEmpty())
+ bookmarkManager->removeBookmarkItem(treeView, src);
+ } break;
+
+ case Qt::Key_Up: {
+ case Qt::Key_Down:
+ if (!tree)
treeView->subclassKeyPressEvent(ke);
- } break;
-
- case Qt::Key_Enter: {
- case Qt::Key_Return:
- index = treeView->selectionModel()->currentIndex();
- if (index.isValid()) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- emit requestShowLink(data);
- }
- } break;
+ } break;
- case Qt::Key_Escape: {
- emit escapePressed();
- } break;
- }
- } else if (e->type() == QEvent::MouseButtonRelease) {
- if (index.isValid()) {
- QMouseEvent *me = static_cast<QMouseEvent*>(e);
- bool controlPressed = me->modifiers() & Qt::ControlModifier;
- if(((me->button() == Qt::LeftButton) && controlPressed)
- || (me->button() == Qt::MidButton)) {
- QString data = index.data(Qt::UserRole + 10).toString();
- if (!data.isEmpty() && data != QLatin1String("Folder"))
- CentralWidget::instance()->setSourceInNewTab(data);
- }
- }
+ case Qt::Key_Escape: {
+ emit escapePressed();
+ } break;
+
+ default: break;
}
}
+
+ if (e->type() == QEvent::MouseButtonRelease) {
+ QMouseEvent *me = static_cast<QMouseEvent*>(e);
+ bool controlPressed = me->modifiers() & Qt::ControlModifier;
+ if(((me->button() == Qt::LeftButton) && controlPressed)
+ || (me->button() == Qt::MidButton)) {
+ const QModelIndex &index = treeView->currentIndex();
+ const QString &data = index.data(Qt::UserRole + 10).toString();
+ if (!data.isEmpty() && data != QLatin1String("Folder"))
+ CentralWidget::instance()->setSourceInNewTab(data);
+ }
+ }
+
return QWidget::eventFilter(object, e);
}