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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
Merged upstream commits:
6fc55b9abd783b624241d56e34751ea495adbd7d "KDE4: actually apply file dialog operation mode"
b613270a730ace29dd1b16b29be2222b34f34a5d "KDE4: improve default load and save dialog titles"
diff -u b/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
--- b/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -58,6 +58,8 @@
#include "generic/geninst.h"
+#include "svids.hrc"
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
@@ -109,7 +111,6 @@
KDE4FilePicker::KDE4FilePicker( const uno::Reference<uno::XComponentContext>& )
: KDE4FilePicker_Base(_helperMutex)
- , _resMgr( ResMgr::CreateResMgr("fps_office") )
, allowRemoteUrls( false )
{
_extraControls = new QWidget();
@@ -128,8 +129,7 @@
#endif
setMultiSelectionMode( false );
- //default mode
- _dialog->setOperationMode(KFileDialog::Opening);
+ _dialog->setConfirmOverwrite( true );
// XExecutableDialog functions
connect( this, SIGNAL( setTitleSignal( const OUString & ) ),
@@ -202,7 +202,6 @@
SalYieldMutexReleaser aReleaser;
return Q_EMIT cleanupProxySignal();
}
- delete _resMgr;
delete _dialog;
}
@@ -524,6 +523,24 @@
return toOUString(label);
}
+QString KDE4FilePicker::getResString( sal_Int16 aRedId )
+{
+ QString aResString;
+
+ if( aRedId < 0 )
+ return aResString;
+
+ try
+ {
+ aResString = toQString(ResId(aRedId, *ImplGetResMgr()).toString());
+ }
+ catch(...)
+ {
+ }
+
+ return aResString.replace('~', '&');
+}
+
void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
{
QWidget* widget = 0;
@@ -532,37 +549,37 @@
switch (controlId)
{
case CHECKBOX_AUTOEXTENSION:
- resId = STR_SVT_FILEPICKER_AUTO_EXTENSION;
+ resId = STR_FPICKER_AUTO_EXTENSION;
break;
case CHECKBOX_PASSWORD:
- resId = STR_SVT_FILEPICKER_PASSWORD;
+ resId = STR_FPICKER_PASSWORD;
break;
case CHECKBOX_FILTEROPTIONS:
- resId = STR_SVT_FILEPICKER_FILTER_OPTIONS;
+ resId = STR_FPICKER_FILTER_OPTIONS;
break;
case CHECKBOX_READONLY:
- resId = STR_SVT_FILEPICKER_READONLY;
+ resId = STR_FPICKER_READONLY;
break;
case CHECKBOX_LINK:
- resId = STR_SVT_FILEPICKER_INSERT_AS_LINK;
+ resId = STR_FPICKER_INSERT_AS_LINK;
break;
case CHECKBOX_PREVIEW:
- resId = STR_SVT_FILEPICKER_SHOW_PREVIEW;
+ resId = STR_FPICKER_SHOW_PREVIEW;
break;
case CHECKBOX_SELECTION:
- resId = STR_SVT_FILEPICKER_SELECTION;
+ resId = STR_FPICKER_SELECTION;
break;
case PUSHBUTTON_PLAY:
- resId = STR_SVT_FILEPICKER_PLAY;
+ resId = STR_FPICKER_PLAY;
break;
case LISTBOX_VERSION:
- resId = STR_SVT_FILEPICKER_VERSION;
+ resId = STR_FPICKER_VERSION;
break;
case LISTBOX_TEMPLATE:
- resId = STR_SVT_FILEPICKER_TEMPLATES;
+ resId = STR_FPICKER_TEMPLATES;
break;
case LISTBOX_IMAGE_TEMPLATE:
- resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE;
+ resId = STR_FPICKER_IMAGE_TEMPLATE;
break;
case LISTBOX_VERSION_LABEL:
case LISTBOX_TEMPLATE_LABEL:
@@ -581,16 +598,7 @@
case CHECKBOX_PREVIEW:
case CHECKBOX_SELECTION:
{
- QString label;
-
- if (_resMgr && resId != -1)
- {
- OUString s(ResId(resId, *_resMgr).toString());
- label = toQString(s);
- label.replace("~", "&");
- }
-
- widget = new QCheckBox(label, _extraControls);
+ widget = new QCheckBox(getResString(resId), _extraControls);
// the checkbox is created even for CHECKBOX_AUTOEXTENSION to simplify
// code, but the checkbox is hidden and ignored
@@ -719,8 +727,22 @@
1 );
}
- _dialog->setOperationMode(operationMode);
- _dialog->setConfirmOverwrite(true);
+ _dialog->setOperationMode( operationMode );
+
+ sal_Int16 resId = -1;
+ switch (_dialog->operationMode())
+ {
+ case KFileDialog::Opening:
+ resId = STR_FPICKER_OPEN;
+ break;
+ case KFileDialog::Saving:
+ resId = STR_FPICKER_SAVE;
+ break;
+ default:
+ break;
+ }
+
+ _dialog->setCaption(getResString(resId));
}
void SAL_CALL KDE4FilePicker::cancel()
only in patch2:
unchanged:
--- a/vcl/unx/kde4/KDE4FilePicker.hxx
+++ b/vcl/unx/kde4/KDE4FilePicker.hxx
@@ -41,8 +41,6 @@ class KFileDialog;
class QWidget;
class QLayout;
-class ResMgr;
-
typedef ::cppu::WeakComponentImplHelper5
< ::com::sun::star::ui::dialogs::XFilePicker2
, ::com::sun::star::ui::dialogs::XFilePicker3
@@ -61,8 +59,6 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener;
- ResMgr *_resMgr;
-
//the dialog to display
KFileDialog* _dialog;
@@ -225,6 +221,8 @@ private:
//add a custom control widget to the file dialog
void addCustomControl(sal_Int16 controlId);
+ QString getResString( sal_Int16 aRedId );
+
private Q_SLOTS:
void cleanupProxy();
void checkProtocol();
|