1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <cstddef>
#include <kdemodalityfilter.hxx>
#include <kdefilepicker.hxx>
#include <kdecommandthread.hxx>
#if ENABLE_TDE
#include <tqeventloop.h>
#include <tdeaboutdata.h>
#include <tdeapplication.h>
#include <tdecmdlineargs.h>
#else // ENABLE_TDE
#include <kaboutdata.h>
#include <kapplication.h>
#include <kcmdlineargs.h>
#endif // ENABLE_TDE
#include <iostream>
#include <stdlib.h>
#include <config_vclplug.h>
#if ENABLE_TDE
#define THIS_DESKENV_NAME_CAP "TDE"
#define THIS_DESKENV_NAME_LOW "tde"
#else // ENABLE_TDE
#define THIS_DESKENV_NAME_CAP "KDE"
#define THIS_DESKENV_NAME_LOW "kde"
#endif // ENABLE_TDE
#if ENABLE_TDE
#define KAboutData TDEAboutData
#define KCmdLineArgs TDECmdLineArgs
#define KCmdLineOptions TDECmdLineOptions
#define KCmdLineLastOption TDECmdLineLastOption
#define KApplication TDEApplication
#define KLocale TDELocale
#endif // ENABLE_TDE
// Main
static const 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 "LibreOffice" in the
// title
KAboutData qAboutData( "kdefilepicker", I18N_NOOP( "LibreOffice" ),
"0.1", I18N_NOOP( "kdefilepicker is an implementation of the " THIS_DESKENV_NAME_CAP " file dialog for LibreOffice." ),
KAboutData::License_LGPL,
"(c) 2004, Jan Holesovsky" );
qAboutData.addAuthor( "Jan Holesovsky", I18N_NOOP("Original author"), "kendy@collabora.com" );
// Let the user see that this does something...
::std::cerr << "kdefilepicker, an implementation of a " THIS_DESKENV_NAME_CAP " 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;
// Setup the modality
KCmdLineArgs *pArgs = KCmdLineArgs::parsedArgs();
long nWinId = atol( pArgs->getOption( "winid" ) );
pArgs->clear();
KDEModalityFilter qModalityFilter( nWinId );
KDEFileDialog aFileDialog( NULL, QString(), NULL, THIS_DESKENV_NAME_LOW "filedialog" );
KDECommandThread qCommandThread( &aFileDialog );
qCommandThread.start();
kApplication.exec();
qCommandThread.wait();
::std::cout << "exited" << ::std::endl;
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|