summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-08-25 17:54:25 +0200
committerJan Holesovsky <kendy@suse.cz>2010-08-26 12:54:54 +0200
commit6a0e659e748edb5b4501b1af6e44679a9b029b32 (patch)
treec042db8fd71edd68930925df84ad5a6c2e129031
parente9c54c9a4d67d9262808890512e445fd71c7b647 (diff)
fpicker-kde-modal.diff: KDE fpicker should be modal.
n#265718.
-rw-r--r--fpicker/source/unx/kde/kdefpmain.cxx15
-rw-r--r--fpicker/source/unx/kde/kdemodalityfilter.cxx2
-rw-r--r--fpicker/source/unx/kde_unx/UnxFilePicker.cxx31
3 files changed, 42 insertions, 6 deletions
diff --git a/fpicker/source/unx/kde/kdefpmain.cxx b/fpicker/source/unx/kde/kdefpmain.cxx
index 30c832bc61..201c389ddf 100644
--- a/fpicker/source/unx/kde/kdefpmain.cxx
+++ b/fpicker/source/unx/kde/kdefpmain.cxx
@@ -40,6 +40,12 @@
// Main
//////////////////////////////////////////////////////////////////////////
+static KCmdLineOptions sOptions[] =
+{
+ { "winid <argument>", I18N_NOOP("Window ID to which is the fpicker modal"), "0" },
+ KCmdLineLastOption
+};
+
int main( int argc, char* argv[] )
{
// we fake the name of the application to have "OpenOffice.org" in the
@@ -54,12 +60,19 @@ int main( int argc, char* argv[] )
::std::cerr << "kdefilepicker, an implementation of KDE file dialog for OOo." << ::std::endl
<< "Type 'exit' and press Enter to finish." << ::std::endl;
+ KCmdLineArgs::addCmdLineOptions( sOptions );
KCmdLineArgs::init( argc, argv, &qAboutData );
KLocale::setMainCatalogue( "kdialog" );
KApplication kApplication;
- //ModalityFilter qFilter( /*winid*/ 79691780 );
+
+ // Setup the modality
+ KCmdLineArgs *pArgs = KCmdLineArgs::parsedArgs();
+ long nWinId = atol( pArgs->getOption( "winid" ) );
+ pArgs->clear();
+
+ ModalityFilter qModalityFilter( nWinId );
FileDialog aFileDialog( NULL, QString(), NULL, "kdefiledialog" );
diff --git a/fpicker/source/unx/kde/kdemodalityfilter.cxx b/fpicker/source/unx/kde/kdemodalityfilter.cxx
index c214bca001..cf39da77eb 100644
--- a/fpicker/source/unx/kde/kdemodalityfilter.cxx
+++ b/fpicker/source/unx/kde/kdemodalityfilter.cxx
@@ -57,8 +57,6 @@ bool ModalityFilter::eventFilter( QObject *pObject, QEvent *pEvent )
if ( pDlg != NULL && m_nWinId != 0 )
{
XSetTransientForHint( qt_xdisplay(), pDlg->winId(), m_nWinId );
- NETWinInfo aInfo( qt_xdisplay(), pDlg->winId(), qt_xrootwin(), NET::WMState );
- aInfo.setState( NET::Modal, NET::Modal );
m_nWinId = 0;
}
}
diff --git a/fpicker/source/unx/kde_unx/UnxFilePicker.cxx b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx
index a712e779e6..0ae7c4dfd4 100644
--- a/fpicker/source/unx/kde_unx/UnxFilePicker.cxx
+++ b/fpicker/source/unx/kde_unx/UnxFilePicker.cxx
@@ -46,9 +46,15 @@
#include <UnxCommandThread.hxx>
#include <UnxNotifyThread.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/window.hxx>
+
#include <sys/wait.h>
#include <unistd.h>
#include <fcntl.h>
+#include <stdio.h>
#include <iostream>
@@ -447,7 +453,7 @@ void SAL_CALL UnxFilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUStri
sendCommand( aBuffer.makeStringAndClear() );
}
-rtl::OUString SAL_CALL UnxFilePicker::getLabel(sal_Int16 nControlId)
+rtl::OUString SAL_CALL UnxFilePicker::getLabel(sal_Int16 /*nControlId*/)
throw ( uno::RuntimeException )
{
// FIXME getLabel() is not yet implemented
@@ -703,10 +709,29 @@ void UnxFilePicker::initFilePicker()
}
#endif
- // FIXME: window id, etc.
+ // The executable name
const char *pFname = "kdefilepicker";
- execlp( pFname, pFname, NULL );
+ // ID of the main window
+ const int nIdLen = 20;
+ char pWinId[nIdLen] = "0";
+
+ // TODO pass here the real parent (not possible for system dialogs
+ // yet), and default to GetDefDialogParent() only when the real parent
+ // is NULL
+ Window *pParentWin = Application::GetDefDialogParent();
+ if ( pParentWin )
+ {
+ const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData();
+ if ( pSysData )
+ {
+ snprintf( pWinId, nIdLen, "%ld", pSysData->aWindow ); // unx only
+ pWinId[nIdLen-1] = 0;
+ }
+ }
+
+ // Execute the fpicker implementation
+ execlp( pFname, pFname, "--winid", pWinId, NULL );
// Error, finish the child
exit( -1 );