From af3e7ef5c3011a389298a8a7fb63c48b8857aa73 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Tue, 28 Aug 2012 13:46:22 +0200 Subject: [PATCH 1/6] Fixed issue 280 --- src/desktop/UBDesktopAnnotationController.cpp | 17 ++++++++++++++--- src/desktop/UBDesktopAnnotationController.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index ddfce593..28987757 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -102,9 +102,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) } connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(goToUniboard())); + connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(customClick()), this, SLOT(customCapture())); + connect(mDesktopPalette, SIGNAL(customClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(windowCapture())); + connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); + connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); @@ -382,6 +386,7 @@ void UBDesktopAnnotationController::hideWindow() void UBDesktopAnnotationController::goToUniboard() { + onToolClicked(); hideWindow(); UBPlatformUtils::setDesktopMode(false); @@ -397,6 +402,7 @@ void UBDesktopAnnotationController::goToUniboard() void UBDesktopAnnotationController::customCapture() { + onToolClicked(); mIsFullyTransparent = true; updateBackground(); @@ -424,6 +430,7 @@ void UBDesktopAnnotationController::customCapture() void UBDesktopAnnotationController::windowCapture() { + onToolClicked(); mIsFullyTransparent = true; updateBackground(); @@ -453,6 +460,7 @@ void UBDesktopAnnotationController::windowCapture() void UBDesktopAnnotationController::screenCapture() { + onToolClicked(); mIsFullyTransparent = true; updateBackground(); @@ -539,7 +547,6 @@ void UBDesktopAnnotationController::penActionPressed() */ void UBDesktopAnnotationController::penActionReleased() { - qDebug() << "penActionReleased()"; mHoldTimerPen.stop(); if(mPendingPenButtonPressed) { @@ -594,7 +601,6 @@ void UBDesktopAnnotationController::eraserActionPressed() */ void UBDesktopAnnotationController::eraserActionReleased() { - qDebug() << "eraserActionReleased()"; mHoldTimerEraser.stop(); if(mPendingEraserButtonPressed) { @@ -651,7 +657,6 @@ void UBDesktopAnnotationController::markerActionPressed() */ void UBDesktopAnnotationController::markerActionReleased() { - qDebug() << "markerActionReleased()"; mHoldTimerMarker.stop(); if(mPendingMarkerButtonPressed) { @@ -930,3 +935,9 @@ void UBDesktopAnnotationController::refreshMask() updateMask(true); } } + +void UBDesktopAnnotationController::onToolClicked(){ + mDesktopEraserPalette->hide(); + mDesktopMarkerPalette->hide(); + mDesktopPenPalette->hide(); +} diff --git a/src/desktop/UBDesktopAnnotationController.h b/src/desktop/UBDesktopAnnotationController.h index 207db94b..c98b2466 100644 --- a/src/desktop/UBDesktopAnnotationController.h +++ b/src/desktop/UBDesktopAnnotationController.h @@ -111,6 +111,7 @@ class UBDesktopAnnotationController : public QObject void onDesktopPaletteMinimize(); void onTransparentWidgetResized(); void refreshMask(); + void onToolClicked(); private: void setAssociatedPalettePosition(UBActionPalette* palette, const QString& actionName); From a591d30cc6815bb746000c5cf61a5732d161926d Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Tue, 28 Aug 2012 14:45:55 +0200 Subject: [PATCH 2/6] Corrected a small issue --- src/desktop/UBDesktopAnnotationController.cpp | 1 + src/desktop/UBDesktopPalette.cpp | 2 ++ src/desktop/UBDesktopPalette.h | 1 + 3 files changed, 4 insertions(+) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 28987757..165e8fcb 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -109,6 +109,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(onToolClicked())); + connect(mDesktopPalette, SIGNAL(pointerClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 2b3902b2..558f70e1 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -39,6 +39,8 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) actions << UBApplication::mainWindow->actionSelector; actions << UBApplication::mainWindow->actionPointer; + connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered()), this, SIGNAL(pointerClick())); + if (UBPlatformUtils::hasVirtualKeyboard()) actions << UBApplication::mainWindow->actionVirtualKeyboard; diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index cd22d43e..359c43f1 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -33,6 +33,7 @@ class UBDesktopPalette : public UBActionPalette void customClick(); void windowClick(); void screenClick(); + void pointerClick(); #ifdef Q_WS_X11 void refreshMask(); From dae012bb38fb3af68eacb06440ed00c0811c5296 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Tue, 28 Aug 2012 14:58:11 +0200 Subject: [PATCH 3/6] Corrected another small issue --- src/desktop/UBDesktopAnnotationController.cpp | 1 + src/desktop/UBDesktopPalette.cpp | 1 + src/desktop/UBDesktopPalette.h | 1 + 3 files changed, 3 insertions(+) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 165e8fcb..f431f55e 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -110,6 +110,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(pointerClick()), this, SLOT(onToolClicked())); + connect(mDesktopPalette, SIGNAL(arrowClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 558f70e1..2ec3f3dc 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -40,6 +40,7 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) actions << UBApplication::mainWindow->actionPointer; connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered()), this, SIGNAL(pointerClick())); + connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered()), this, SIGNAL(arrowClicked())); if (UBPlatformUtils::hasVirtualKeyboard()) actions << UBApplication::mainWindow->actionVirtualKeyboard; diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index 359c43f1..79553087 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -34,6 +34,7 @@ class UBDesktopPalette : public UBActionPalette void windowClick(); void screenClick(); void pointerClick(); + void arrowClicked(); #ifdef Q_WS_X11 void refreshMask(); From 3ef2b22340eb536d343528e9e04660717869018e Mon Sep 17 00:00:00 2001 From: Didier Date: Tue, 28 Aug 2012 15:00:38 +0200 Subject: [PATCH 4/6] Fixed a signal issue --- src/desktop/UBDesktopAnnotationController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index f431f55e..db32c695 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -110,7 +110,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(pointerClick()), this, SLOT(onToolClicked())); - connect(mDesktopPalette, SIGNAL(arrowClick()), this, SLOT(onToolClicked())); + connect(mDesktopPalette, SIGNAL(arrowClicked()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); From 3fb1e75c6b448caa8eb4edeab24347f4eaebf51b Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Tue, 28 Aug 2012 15:09:43 +0200 Subject: [PATCH 5/6] Did a better implementation of this fix --- src/desktop/UBDesktopAnnotationController.cpp | 4 ++-- src/desktop/UBDesktopPalette.cpp | 3 --- src/desktop/UBDesktopPalette.h | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index db32c695..9e5003c6 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -109,8 +109,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(mDesktopPalette, SIGNAL(windowClick()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(onToolClicked())); - connect(mDesktopPalette, SIGNAL(pointerClick()), this, SLOT(onToolClicked())); - connect(mDesktopPalette, SIGNAL(arrowClicked()), this, SLOT(onToolClicked())); + connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered()), this, SLOT(onToolClicked())); + connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered()), this, SLOT(onToolClicked())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); diff --git a/src/desktop/UBDesktopPalette.cpp b/src/desktop/UBDesktopPalette.cpp index 2ec3f3dc..2b3902b2 100644 --- a/src/desktop/UBDesktopPalette.cpp +++ b/src/desktop/UBDesktopPalette.cpp @@ -39,9 +39,6 @@ UBDesktopPalette::UBDesktopPalette(QWidget *parent) actions << UBApplication::mainWindow->actionSelector; actions << UBApplication::mainWindow->actionPointer; - connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered()), this, SIGNAL(pointerClick())); - connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered()), this, SIGNAL(arrowClicked())); - if (UBPlatformUtils::hasVirtualKeyboard()) actions << UBApplication::mainWindow->actionVirtualKeyboard; diff --git a/src/desktop/UBDesktopPalette.h b/src/desktop/UBDesktopPalette.h index 79553087..cd22d43e 100644 --- a/src/desktop/UBDesktopPalette.h +++ b/src/desktop/UBDesktopPalette.h @@ -33,8 +33,6 @@ class UBDesktopPalette : public UBActionPalette void customClick(); void windowClick(); void screenClick(); - void pointerClick(); - void arrowClicked(); #ifdef Q_WS_X11 void refreshMask(); From d9be3652f5b1eebb46a7c90590ecfa41bc027849 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Tue, 28 Aug 2012 17:08:18 +0300 Subject: [PATCH 6/6] SANKORE-985 shutdown after emptying the trashbin --- src/document/UBDocumentController.cpp | 91 ++++++++++++++++++--------- 1 file changed, 62 insertions(+), 29 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index dbe0707b..4be9ee0f 100755 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -551,8 +551,11 @@ void UBDocumentController::deleteSelectedItem() { if(UBApplication::mainWindow->yesNoQuestion(tr("Remove Document"), tr("Are you sure you want to remove the document '%1'?").arg(proxyTi->proxy()->metaData(UBSettings::documentName).toString()))) { - if (proxyTi->parent() == mTrashTi) + if (proxyTi->parent() != mTrashTi) { + // We have to move document into Trash + // Select another document for processing + // This is for Board, where this document can be selected int index = proxyTi->parent()->indexOfChild(proxyTi); index --; @@ -560,7 +563,7 @@ void UBDocumentController::deleteSelectedItem() { if (proxyTi->proxy() == mBoardController->selectedDocument()) { - selectDocument(((UBDocumentProxyTreeItem*)proxyTi->parent()->child(index))->proxy()); + selectDocument(((UBDocumentProxyTreeItem*)proxyTi->parent()->child(index))->proxy(), true); } else proxyTi->parent()->child(index)->setSelected(true); @@ -569,7 +572,7 @@ void UBDocumentController::deleteSelectedItem() { if (proxyTi->proxy() == mBoardController->selectedDocument()) { - selectDocument(((UBDocumentProxyTreeItem*)proxyTi->parent()->child(1))->proxy()); + selectDocument(((UBDocumentProxyTreeItem*)proxyTi->parent()->child(1))->proxy(), true); } else proxyTi->parent()->child(1)->setSelected(true); @@ -578,30 +581,36 @@ void UBDocumentController::deleteSelectedItem() { if (proxyTi->proxy() == mBoardController->selectedDocument()) { + bool documentFound = false; for (int i = 0; i < mDocumentUI->documentTreeWidget->topLevelItemCount(); i++) { QTreeWidgetItem* item = mDocumentUI->documentTreeWidget->topLevelItem(i); UBDocumentGroupTreeItem* groupItem = dynamic_cast(item); - if (groupItem != selectedDocumentGroupTreeItem() && groupItem->childCount() > 0) + if (!groupItem->isTrashFolder()) { - selectDocument(((UBDocumentProxyTreeItem*)groupItem->child(0))->proxy()); - break; + for(int j=0; jchildCount(); j++) + { + if (((UBDocumentProxyTreeItem*)groupItem->child(j))->proxy() != mBoardController->selectedDocument()) + { + selectDocument(((UBDocumentProxyTreeItem*)groupItem->child(0))->proxy(), true); + documentFound = true; + break; + } + } } + if (documentFound) + break; + } + if (!documentFound) + { + UBDocumentProxy *document = UBPersistenceManager::persistenceManager()->createDocument(groupTi->groupName()); + selectDocument(document, true); } } else proxyTi->parent()->setSelected(true); } - proxyTi->parent()->removeChild(proxyTi); - - UBPersistenceManager::persistenceManager()->deleteDocument(proxyTi->proxy()); - - reloadThumbnails(); - } - else - { - // Move document to trash QString oldGroupName = proxyTi->proxy()->metaData(UBSettings::documentGroupName).toString(); proxyTi->proxy()->setMetaData(UBSettings::documentGroupName, UBSettings::trashedDocumentGroupNamePrefix + oldGroupName); UBPersistenceManager::persistenceManager()->persistDocumentMetadata(proxyTi->proxy()); @@ -610,6 +619,14 @@ void UBDocumentController::deleteSelectedItem() mTrashTi->addChild(proxyTi); proxyTi->setFlags(proxyTi->flags() ^ Qt::ItemIsEditable); } + else + { + // We have to physical delete document + // No action with selection required - document from Trash cant be selected in Board + + proxyTi->parent()->removeChild(proxyTi); + UBPersistenceManager::persistenceManager()->deleteDocument(proxyTi->proxy()); + } } } else if (groupTi) @@ -661,20 +678,6 @@ void UBDocumentController::deleteSelectedItem() } } - if (changeCurrentDocument) - { - for (int i = 0; i < mDocumentUI->documentTreeWidget->topLevelItemCount(); i++) - { - QTreeWidgetItem* item = mDocumentUI->documentTreeWidget->topLevelItem(i); - UBDocumentGroupTreeItem* groupItem = dynamic_cast(item); - if (groupItem != groupTi && groupItem->childCount() > 0) - { - selectDocument(((UBDocumentProxyTreeItem*)groupItem->child(0))->proxy()); - break; - } - } - } - QList toBeDeleted; for (int i = 0; i < groupTi->childCount(); i++) @@ -712,6 +715,36 @@ void UBDocumentController::deleteSelectedItem() } } + if (changeCurrentDocument) + { + bool documentFound = false; + for (int i = 0; i < mDocumentUI->documentTreeWidget->topLevelItemCount(); i++) + { + QTreeWidgetItem* item = mDocumentUI->documentTreeWidget->topLevelItem(i); + UBDocumentGroupTreeItem* groupItem = dynamic_cast(item); + if (!groupItem->isTrashFolder() && groupItem != groupTi) + { + for(int j=0; jchildCount(); j++) + { + if (((UBDocumentProxyTreeItem*)groupItem->child(j))->proxy() != mBoardController->selectedDocument()) + { + selectDocument(((UBDocumentProxyTreeItem*)groupItem->child(0))->proxy(), true); + documentFound = true; + break; + } + } + } + if (documentFound) + break; + } + if (!documentFound) + { + UBDocumentProxy *document = UBPersistenceManager::persistenceManager()->createDocument( UBSettings::defaultDocumentGroupName ); + selectDocument(document, true); + } + } + + reloadThumbnails(); QApplication::restoreOverrideCursor();