Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / vcl / unx / kde / fpicker / kdefpmain.cxx
blobd7152a53ae85a3727e9536a7bf27fd351e11c8fc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cstddef>
22 #include <kdemodalityfilter.hxx>
23 #include <kdefilepicker.hxx>
24 #include <kdecommandthread.hxx>
26 #if ENABLE_TDE
27 #include <tqeventloop.h>
28 #include <tdeaboutdata.h>
29 #include <tdeapplication.h>
30 #include <tdecmdlineargs.h>
31 #else // ENABLE_TDE
32 #include <kaboutdata.h>
33 #include <kapplication.h>
34 #include <kcmdlineargs.h>
35 #endif // ENABLE_TDE
37 #include <iostream>
38 #include <stdlib.h>
40 #include <config_vclplug.h>
42 #if ENABLE_TDE
43 #define THIS_DESKENV_NAME_CAP "TDE"
44 #define THIS_DESKENV_NAME_LOW "tde"
45 #else // ENABLE_TDE
46 #define THIS_DESKENV_NAME_CAP "KDE"
47 #define THIS_DESKENV_NAME_LOW "kde"
48 #endif // ENABLE_TDE
50 #if ENABLE_TDE
51 #define KAboutData TDEAboutData
52 #define KCmdLineArgs TDECmdLineArgs
53 #define KCmdLineOptions TDECmdLineOptions
54 #define KCmdLineLastOption TDECmdLineLastOption
55 #define KApplication TDEApplication
56 #define KLocale TDELocale
57 #endif // ENABLE_TDE
59 // Main
61 static const KCmdLineOptions sOptions[] =
63 { "winid <argument>", I18N_NOOP("Window ID to which is the fpicker modal"), "0" },
64 KCmdLineLastOption
67 int main( int argc, char* argv[] )
69 // we fake the name of the application to have "LibreOffice" in the
70 // title
71 KAboutData qAboutData( "kdefilepicker", I18N_NOOP( "LibreOffice" ),
72 "0.1", I18N_NOOP( "kdefilepicker is an implementation of the " THIS_DESKENV_NAME_CAP " file dialog for LibreOffice." ),
73 KAboutData::License_LGPL,
74 "(c) 2004, Jan Holesovsky" );
75 qAboutData.addAuthor( "Jan Holesovsky", I18N_NOOP("Original author and current maintainer"), "kendy@openoffice.org" );
77 // Let the user see that this does something...
78 ::std::cerr << "kdefilepicker, an implementation of a " THIS_DESKENV_NAME_CAP " file dialog for OOo." << ::std::endl
79 << "Type 'exit' and press Enter to finish." << ::std::endl;
81 KCmdLineArgs::addCmdLineOptions( sOptions );
82 KCmdLineArgs::init( argc, argv, &qAboutData );
84 KLocale::setMainCatalogue( "kdialog" );
86 KApplication kApplication;
88 // Setup the modality
89 KCmdLineArgs *pArgs = KCmdLineArgs::parsedArgs();
90 long nWinId = atol( pArgs->getOption( "winid" ) );
91 pArgs->clear();
93 KDEModalityFilter qModalityFilter( nWinId );
95 KDEFileDialog aFileDialog( NULL, QString(), NULL, THIS_DESKENV_NAME_LOW "filedialog" );
97 KDECommandThread qCommandThread( &aFileDialog );
98 qCommandThread.start();
100 kApplication.exec();
102 qCommandThread.wait();
104 ::std::cout << "exited" << ::std::endl;
106 return 0;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */