17 |
17 |
18 #include "enginewrapper.h" |
18 #include "enginewrapper.h" |
19 #include "engine.h" |
19 #include "engine.h" |
20 #include "FBFileUtils.h" |
20 #include "FBFileUtils.h" |
21 #include "notifications.h" |
21 #include "notifications.h" |
22 #include "filebrowserview.h" |
22 #include "fbfileview.h" |
23 #include "searchview.h" |
23 #include "searchview.h" |
24 #include "filebrowsersettings.h" |
24 #include "filebrowsersettings.h" |
25 #include "settingsview.h" |
25 #include "settingsview.h" |
26 |
26 |
|
27 #include <HbProgressDialog> |
|
28 |
27 #include <QString> |
29 #include <QString> |
28 #include <QFileInfo> |
30 #include <QFileInfo> |
29 #include <QModelIndex> |
31 #include <QModelIndex> |
30 |
32 |
31 // --------------------------------------------------------------------------- |
33 // --------------------------------------------------------------------------- |
32 |
34 |
33 EngineWrapper::EngineWrapper() |
35 EngineWrapper::EngineWrapper() |
34 : mEngine(0), |
36 : mEngine(0), |
35 mFilesFound(), |
37 mFilesFound(), |
36 mSettings(0) |
38 mSettings(0), |
|
39 mProgressDialog(0), |
|
40 mWaitDialog(0) |
37 { |
41 { |
38 } |
42 } |
39 |
43 |
40 // --------------------------------------------------------------------------- |
44 // --------------------------------------------------------------------------- |
41 |
45 |
684 void EngineWrapper::toolsSetDebugMask(quint32 aDbgMask) |
693 void EngineWrapper::toolsSetDebugMask(quint32 aDbgMask) |
685 { |
694 { |
686 mEngine->FileUtils()->SetDebugMaskL(aDbgMask); |
695 mEngine->FileUtils()->SetDebugMaskL(aDbgMask); |
687 } |
696 } |
688 |
697 |
|
698 void EngineWrapper::toolsWriteAllFiles() |
|
699 { |
|
700 mEngine->FileUtils()->WriteAllFilesL(); |
|
701 } |
|
702 |
689 void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType) |
703 void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType) |
690 { |
704 { |
691 mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType); |
705 mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType); |
692 } |
706 } |
693 |
707 |
697 |
711 |
698 // --------------------------------------------------------------------------- |
712 // --------------------------------------------------------------------------- |
699 |
713 |
700 void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/) |
714 void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/) |
701 { |
715 { |
702 QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
716 QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
703 Notifications::showErrorNote(qStringText, aNoTimeout); |
717 Notifications::showErrorNote(qText, aNoTimeout); |
704 } |
718 } |
705 |
719 |
706 // --------------------------------------------------------------------------- |
720 // --------------------------------------------------------------------------- |
707 |
721 |
708 void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle) |
722 void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle) |
714 |
728 |
715 // --------------------------------------------------------------------------- |
729 // --------------------------------------------------------------------------- |
716 |
730 |
717 void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/) |
731 void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/) |
718 { |
732 { |
719 QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
733 QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
720 Notifications::showConfirmationNote(qStringText, aNoTimeout); |
734 Notifications::showConfirmationNote(qText, aNoTimeout); |
|
735 } |
|
736 |
|
737 void EngineWrapper::ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum ) |
|
738 { |
|
739 const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
|
740 if (!mProgressDialog) { |
|
741 mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog); |
|
742 QObject::connect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled())); |
|
743 } |
|
744 |
|
745 mProgressDialog->setText(qText); |
|
746 mProgressDialog->setMinimum(aMinimum); |
|
747 mProgressDialog->setMaximum(aMaximum); |
|
748 mEngine->FileUtils()->SetAllowProcessing(true); |
|
749 mProgressDialog->show(); |
|
750 } |
|
751 |
|
752 void EngineWrapper::CancelProgressDialog() |
|
753 { |
|
754 if (mProgressDialog) { |
|
755 QObject::disconnect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled())); |
|
756 mProgressDialog->cancel(); |
|
757 QObject::connect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled())); |
|
758 } |
|
759 } |
|
760 |
|
761 void EngineWrapper::SetProgressValue(TInt aValue) |
|
762 { |
|
763 if (mProgressDialog) |
|
764 mProgressDialog->setProgressValue(aValue); |
|
765 } |
|
766 |
|
767 void EngineWrapper::progressDialogCancelled() |
|
768 { |
|
769 mEngine->FileUtils()->DialogDismissedL(); |
|
770 } |
|
771 |
|
772 void EngineWrapper::ShowWaitDialog(const TDesC& aDescText) |
|
773 { |
|
774 const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
|
775 if (!mWaitDialog) { |
|
776 mWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog); |
|
777 QObject::connect(mWaitDialog, SIGNAL(cancelled()), this, SLOT(waitDialogCancelled())); |
|
778 } |
|
779 |
|
780 mWaitDialog->setText(qText); |
|
781 mEngine->FileUtils()->SetAllowProcessing(true); |
|
782 //mWaitDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
783 mWaitDialog->show(); |
|
784 } |
|
785 |
|
786 void EngineWrapper::CancelWaitDialog() |
|
787 { |
|
788 if (mWaitDialog) |
|
789 mWaitDialog->cancel(); |
|
790 } |
|
791 |
|
792 void EngineWrapper::waitDialogCancelled() |
|
793 { |
|
794 mEngine->FileUtils()->SetAllowProcessing(false); |
|
795 } |
|
796 |
|
797 void EngineWrapper::ProcessEvents() |
|
798 { |
|
799 qApp->processEvents(); |
721 } |
800 } |
722 |
801 |
723 TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText) |
802 TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText) |
724 { |
803 { |
725 QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
804 QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length()); |
726 return Notifications::showConfirmationQuery(qStringText); |
805 return Notifications::showConfirmationQuery(qText); |
727 } |
806 } |
728 |
807 |
729 // --------------------------------------------------------------------------- |
808 // --------------------------------------------------------------------------- |