joachim99@8
|
1 /***************************************************************************
|
joachim99@8
|
2 kreplacements.cpp - description
|
joachim99@8
|
3 -------------------
|
joachim99@8
|
4 begin : Sat Aug 3 2002
|
joachim99@69
|
5 copyright : (C) 2002-2006 by Joachim Eibl
|
joachim99@69
|
6 email : joachim.eibl at gmx.de
|
joachim99@8
|
7 ***************************************************************************/
|
joachim99@8
|
8
|
joachim99@8
|
9 /***************************************************************************
|
joachim99@8
|
10 * *
|
joachim99@8
|
11 * This program is free software; you can redistribute it and/or modify *
|
joachim99@8
|
12 * it under the terms of the GNU General Public License as published by *
|
joachim99@8
|
13 * the Free Software Foundation; either version 2 of the License, or *
|
joachim99@8
|
14 * (at your option) any later version. *
|
joachim99@8
|
15 * *
|
joachim99@8
|
16 ***************************************************************************/
|
joachim99@8
|
17
|
joachim99@8
|
18
|
joachim99@8
|
19 #include "kreplacements.h"
|
joachim99@66
|
20 #include "common.h"
|
joachim99@8
|
21
|
joachim99@8
|
22 #include <assert.h>
|
joachim99@8
|
23
|
joachim99@8
|
24 #include <qnamespace.h>
|
joachim99@8
|
25 #include <qmessagebox.h>
|
joachim99@75
|
26 #include <qmenu.h>
|
joachim99@8
|
27 #include <qmenubar.h>
|
joachim99@8
|
28 #include <qpainter.h>
|
joachim99@8
|
29 #include <qcolordialog.h>
|
joachim99@8
|
30 #include <qfontdialog.h>
|
joachim99@8
|
31 #include <qlabel.h>
|
joachim99@75
|
32 #include <qtextbrowser.h>
|
joachim99@8
|
33 #include <qtextstream.h>
|
joachim99@8
|
34 #include <qlayout.h>
|
joachim99@73
|
35 #include <QTabWidget>
|
joachim99@70
|
36 #include <QPaintEvent>
|
joachim99@70
|
37 #include <QPixmap>
|
joachim99@75
|
38 #include <QProcess>
|
joachim99@75
|
39
|
joachim99@75
|
40 #include <QTabWidget>
|
joachim99@75
|
41 #include <QFileInfo>
|
joachim99@75
|
42 #include <QFileDialog>
|
joachim99@8
|
43
|
joachim99@8
|
44 #include <vector>
|
joachim99@8
|
45 #include <iostream>
|
joachim99@8
|
46 #include <algorithm>
|
joachim99@8
|
47
|
joachim99@66
|
48
|
joachim99@8
|
49 static QString s_copyright;
|
joachim99@8
|
50 static QString s_email;
|
joachim99@8
|
51 static QString s_description;
|
joachim99@8
|
52 static QString s_appName;
|
joachim99@8
|
53 static QString s_version;
|
joachim99@8
|
54 static QString s_homepage;
|
joachim99@66
|
55 static KAboutData* s_pAboutData;
|
joachim99@66
|
56
|
joachim99@8
|
57
|
joachim99@8
|
58 #ifdef _WIN32
|
joachim99@8
|
59 #include <process.h>
|
joachim99@8
|
60 #include <windows.h>
|
joachim99@8
|
61 #endif
|
joachim99@8
|
62
|
joachim99@8
|
63 static void showHelp()
|
joachim99@8
|
64 {
|
joachim99@8
|
65 #ifdef _WIN32
|
joachim99@8
|
66 char buf[200];
|
joachim99@8
|
67 int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 );
|
joachim99@8
|
68
|
joachim99@8
|
69 QString exePath;
|
joachim99@8
|
70 if (r!=0) { exePath = buf; }
|
joachim99@8
|
71 else { exePath = "."; }
|
joachim99@8
|
72
|
joachim99@34
|
73 QFileInfo helpFile( exePath + "\\doc\\en\\index.html" );
|
joachim99@34
|
74 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\en\\index.html" ); }
|
joachim99@34
|
75 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\doc\\index.html" ); }
|
joachim99@34
|
76 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\index.html" ); }
|
joachim99@8
|
77 if ( ! helpFile.exists() )
|
joachim99@8
|
78 {
|
joachim99@34
|
79 QMessageBox::warning( 0, "KDiff3 documentation not found",
|
joachim99@34
|
80 "Couldn't find the documentation. \n\n"
|
joachim99@34
|
81 "The documentation can also be found at the homepage:\n\n "
|
joachim99@34
|
82 " http://kdiff3.sourceforge.net/");
|
joachim99@34
|
83 return;
|
joachim99@8
|
84 }
|
joachim99@8
|
85
|
joachim99@75
|
86 HINSTANCE hi = FindExecutableA( helpFile.fileName().toAscii(), helpFile.absolutePath().toAscii(), buf );
|
joachim99@34
|
87 if ( int(hi)<=32 )
|
joachim99@8
|
88 {
|
joachim99@75
|
89 static QTextBrowser* pBrowser = 0;
|
joachim99@8
|
90 if (pBrowser==0)
|
joachim99@8
|
91 {
|
joachim99@75
|
92 pBrowser = new QTextBrowser( 0 );
|
joachim99@8
|
93 pBrowser->setMinimumSize( 600, 400 );
|
joachim99@8
|
94 }
|
joachim99@8
|
95 pBrowser->setSource(helpFile.filePath());
|
joachim99@8
|
96 pBrowser->show();
|
joachim99@8
|
97 }
|
joachim99@8
|
98 else
|
joachim99@8
|
99 {
|
joachim99@8
|
100 QFileInfo prog( buf );
|
joachim99@80
|
101 QProcess::startDetached ( prog.filePath(), QStringList( "file:///"+helpFile.absoluteFilePath() ) );
|
joachim99@8
|
102 }
|
joachim99@8
|
103
|
joachim99@8
|
104 #else
|
joachim99@75
|
105 static QTextBrowser* pBrowser = 0;
|
joachim99@8
|
106 if (pBrowser==0)
|
joachim99@8
|
107 {
|
joachim99@75
|
108 pBrowser = new QTextBrowser( 0 );
|
joachim99@8
|
109 pBrowser->setMinimumSize( 600, 400 );
|
joachim99@8
|
110 }
|
joachim99@75
|
111 pBrowser->setSource(QUrl("file://usr/local/share/doc/kdiff3/en/index.html"));
|
joachim99@8
|
112 pBrowser->show();
|
joachim99@8
|
113 #endif
|
joachim99@8
|
114 }
|
joachim99@8
|
115
|
joachim99@92
|
116 QString getTranslationDir(const QString& locale)
|
joachim99@53
|
117 {
|
joachim99@53
|
118 #ifdef _WIN32
|
joachim99@80
|
119 wchar_t buf[200];
|
joachim99@80
|
120 int r= SearchPathW( 0, L".", 0, sizeof(buf)/sizeof(wchar_t), buf, 0 );
|
joachim99@53
|
121
|
joachim99@80
|
122 buf[ sizeof(buf)/sizeof(wchar_t) -1 ] = 0;
|
joachim99@53
|
123 QString exePath;
|
joachim99@80
|
124 if (r!=0) { exePath = QString::fromUtf16( (ushort*)&buf[0] ); }
|
joachim99@53
|
125 else { exePath = "."; }
|
joachim99@73
|
126 return exePath+"/translations";
|
joachim99@53
|
127 #else
|
joachim99@92
|
128 return (QString)"/usr/share/locale/" + locale + "/LC_MESSAGES";
|
joachim99@53
|
129 #endif
|
joachim99@53
|
130 }
|
joachim99@8
|
131
|
joachim99@8
|
132 // static
|
joachim99@8
|
133 void KMessageBox::error( QWidget* parent, const QString& text, const QString& caption )
|
joachim99@8
|
134 {
|
joachim99@8
|
135 QMessageBox::critical( parent, caption, text );
|
joachim99@8
|
136 }
|
joachim99@8
|
137
|
joachim99@8
|
138 int KMessageBox::warningContinueCancel( QWidget* parent, const QString& text, const QString& caption,
|
joachim99@8
|
139 const QString& button1 )
|
joachim99@8
|
140 {
|
joachim99@34
|
141 return 0 == QMessageBox::warning( parent, caption, text, button1, "Cancel" ) ? Continue : Cancel;
|
joachim99@8
|
142 }
|
joachim99@8
|
143
|
joachim99@8
|
144 void KMessageBox::sorry( QWidget* parent, const QString& text, const QString& caption )
|
joachim99@8
|
145 {
|
joachim99@8
|
146 QMessageBox::information( parent, caption, text );
|
joachim99@8
|
147 }
|
joachim99@8
|
148
|
joachim99@8
|
149 void KMessageBox::information( QWidget* parent, const QString& text, const QString& caption )
|
joachim99@8
|
150 {
|
joachim99@8
|
151 QMessageBox::information( parent, caption, text );
|
joachim99@8
|
152 }
|
joachim99@8
|
153
|
joachim99@8
|
154 int KMessageBox::warningYesNo( QWidget* parent, const QString& text, const QString& caption,
|
joachim99@8
|
155 const QString& button1, const QString& button2 )
|
joachim99@8
|
156 {
|
joachim99@58
|
157 return 0 == QMessageBox::warning( parent, caption, text, button1, button2, QString::null, 1, 1 ) ? Yes : No;
|
joachim99@8
|
158 }
|
joachim99@8
|
159
|
joachim99@8
|
160 int KMessageBox::warningYesNoCancel( QWidget* parent, const QString& text, const QString& caption,
|
joachim99@8
|
161 const QString& button1, const QString& button2 )
|
joachim99@8
|
162 {
|
joachim99@34
|
163 int val = QMessageBox::warning( parent, caption, text,
|
joachim99@53
|
164 button1, button2, i18n("Cancel") );
|
joachim99@8
|
165 if ( val==0 ) return Yes;
|
joachim99@8
|
166 if ( val==1 ) return No;
|
joachim99@8
|
167 else return Cancel;
|
joachim99@8
|
168 }
|
joachim99@8
|
169
|
joachim99@8
|
170
|
joachim99@80
|
171 KPageDialog::KPageDialog( QWidget* parent )
|
joachim99@75
|
172 : QDialog( parent )
|
joachim99@8
|
173 {
|
joachim99@75
|
174 setModal(true);
|
joachim99@75
|
175 QVBoxLayout *pMainLayout = new QVBoxLayout(this);
|
joachim99@75
|
176 m_pTabWidget = new QTabWidget();
|
joachim99@75
|
177 pMainLayout->addWidget(m_pTabWidget,1);
|
joachim99@8
|
178
|
joachim99@75
|
179 QHBoxLayout* pButtonLayout = new QHBoxLayout();
|
joachim99@75
|
180 pMainLayout->addLayout( pButtonLayout );
|
joachim99@75
|
181
|
joachim99@75
|
182 pButtonLayout->addStretch(1);
|
joachim99@75
|
183 QPushButton* pOk = new QPushButton( i18n("Ok") );
|
joachim99@80
|
184 connect( pOk, SIGNAL( clicked() ), this, SIGNAL(okClicked()) );
|
joachim99@75
|
185 pButtonLayout->addWidget( pOk );
|
joachim99@75
|
186
|
joachim99@75
|
187 QPushButton* pHelp = new QPushButton( i18n("Help") );
|
joachim99@80
|
188 connect( pHelp, SIGNAL( clicked() ), this, SLOT(slotHelpClicked()));
|
joachim99@75
|
189 pButtonLayout->addWidget( pHelp );
|
joachim99@75
|
190
|
joachim99@75
|
191 QPushButton* pDefaults = new QPushButton( i18n("Defaults") );
|
joachim99@80
|
192 connect( pDefaults, SIGNAL( clicked() ), this, SIGNAL(defaultClicked()) );
|
joachim99@75
|
193 pButtonLayout->addWidget( pDefaults );
|
joachim99@75
|
194
|
joachim99@75
|
195 QPushButton* pCancel = new QPushButton( i18n("Cancel") );
|
joachim99@75
|
196 connect( pCancel, SIGNAL( clicked() ), this, SLOT(reject()));
|
joachim99@75
|
197 pButtonLayout->addWidget( pCancel );
|
joachim99@8
|
198 }
|
joachim99@8
|
199
|
joachim99@80
|
200 KPageDialog::~KPageDialog()
|
joachim99@8
|
201 {
|
joachim99@8
|
202 }
|
joachim99@8
|
203
|
joachim99@80
|
204 void KPageDialog::incrementInitialSize ( const QSize& )
|
joachim99@8
|
205 {
|
joachim99@8
|
206 }
|
joachim99@8
|
207
|
joachim99@80
|
208 void KPageDialog::setHelp(const QString&, const QString& )
|
joachim99@8
|
209 {
|
joachim99@8
|
210 }
|
joachim99@8
|
211
|
joachim99@80
|
212 void KPageDialog::slotHelpClicked()
|
joachim99@80
|
213 {
|
joachim99@80
|
214 showHelp();
|
joachim99@80
|
215 }
|
joachim99@8
|
216
|
joachim99@80
|
217 int KPageDialog::BarIcon(const QString& /*iconName*/, int )
|
joachim99@8
|
218 {
|
joachim99@8
|
219 return 0; // Not used for replacement.
|
joachim99@8
|
220 }
|
joachim99@8
|
221
|
joachim99@8
|
222
|
joachim99@80
|
223 QFrame* KPageDialog::addPage( const QString& name, const QString& /*info*/, int )
|
joachim99@8
|
224 {
|
joachim99@73
|
225 QFrame* p = new QFrame();
|
joachim99@71
|
226 p->setObjectName( name );
|
joachim99@75
|
227 m_pTabWidget->addTab( p, name );
|
joachim99@8
|
228 return p;
|
joachim99@8
|
229 }
|
joachim99@8
|
230
|
joachim99@80
|
231 void KPageDialog::addPage( KPageWidgetItem * p )
|
joachim99@80
|
232 {
|
joachim99@80
|
233 m_pTabWidget->addTab( p->m_pWidget, p->m_title );
|
joachim99@80
|
234 }
|
joachim99@80
|
235
|
joachim99@80
|
236 int KPageDialog::spacingHint()
|
joachim99@8
|
237 {
|
joachim99@75
|
238 return 3;
|
joachim99@8
|
239 }
|
joachim99@8
|
240
|
joachim99@80
|
241 KUrl KFileDialog::getSaveUrl( const QString &startDir,
|
joachim99@68
|
242 const QString &filter,
|
joachim99@68
|
243 QWidget *parent, const QString &caption)
|
joachim99@8
|
244 {
|
joachim99@75
|
245 QString s = QFileDialog::getSaveFileName(parent, caption, startDir, filter, 0/*, QFileDialog::DontUseNativeDialog*/);
|
joachim99@80
|
246 return KUrl(s);
|
joachim99@8
|
247 }
|
joachim99@8
|
248
|
joachim99@80
|
249 KUrl KFileDialog::getOpenUrl( const QString & startDir,
|
joachim99@8
|
250 const QString & filter,
|
joachim99@8
|
251 QWidget * parent,
|
joachim99@8
|
252 const QString & caption )
|
joachim99@8
|
253 {
|
joachim99@75
|
254 QString s = QFileDialog::getOpenFileName(parent, caption, startDir, filter );
|
joachim99@80
|
255 return KUrl(s);
|
joachim99@8
|
256 }
|
joachim99@8
|
257
|
joachim99@80
|
258 KUrl KFileDialog::getExistingDirectoryUrl( const QString & startDir,
|
joachim99@8
|
259 QWidget * parent,
|
joachim99@8
|
260 const QString & caption)
|
joachim99@8
|
261 {
|
joachim99@75
|
262 QString s = QFileDialog::getExistingDirectory(parent, caption, startDir);
|
joachim99@80
|
263 return KUrl(s);
|
joachim99@8
|
264 }
|
joachim99@8
|
265
|
joachim99@69
|
266 QString KFileDialog::getSaveFileName (const QString &startDir,
|
joachim99@69
|
267 const QString &filter,
|
joachim99@69
|
268 QWidget *parent,
|
joachim99@69
|
269 const QString &caption)
|
joachim99@69
|
270 {
|
joachim99@75
|
271 return QFileDialog::getSaveFileName( parent, caption, startDir, filter );
|
joachim99@69
|
272 }
|
joachim99@69
|
273
|
joachim99@8
|
274
|
joachim99@8
|
275 KToolBar::BarPosition KToolBar::barPos()
|
joachim99@8
|
276 {
|
joachim99@75
|
277 if ( m_pMainWindow->toolBarArea(this)==Qt::LeftToolBarArea ) return Left;
|
joachim99@75
|
278 if ( m_pMainWindow->toolBarArea(this)==Qt::RightToolBarArea ) return Right;
|
joachim99@75
|
279 if ( m_pMainWindow->toolBarArea(this)==Qt::BottomToolBarArea ) return Bottom;
|
joachim99@75
|
280 if ( m_pMainWindow->toolBarArea(this)==Qt::TopToolBarArea ) return Top;
|
joachim99@8
|
281 return Top;
|
joachim99@8
|
282 }
|
joachim99@8
|
283
|
joachim99@66
|
284 void KToolBar::setBarPos(BarPosition bp)
|
joachim99@8
|
285 {
|
joachim99@75
|
286 if ( bp == Left ) m_pMainWindow->addToolBar ( Qt::LeftToolBarArea, this );
|
joachim99@75
|
287 else if ( bp == Right ) m_pMainWindow->addToolBar ( Qt::RightToolBarArea, this );
|
joachim99@75
|
288 else if ( bp == Bottom ) m_pMainWindow->addToolBar ( Qt::BottomToolBarArea, this );
|
joachim99@75
|
289 else if ( bp == Top ) m_pMainWindow->addToolBar ( Qt::TopToolBarArea, this );
|
joachim99@8
|
290 }
|
joachim99@8
|
291
|
joachim99@75
|
292 KToolBar::KToolBar( QMainWindow* parent )
|
joachim99@75
|
293 : QToolBar( parent )
|
joachim99@8
|
294 {
|
joachim99@66
|
295 m_pMainWindow = parent;
|
joachim99@8
|
296 }
|
joachim99@8
|
297
|
joachim99@8
|
298
|
joachim99@80
|
299 KMainWindow::KMainWindow( QWidget* parent )
|
joachim99@75
|
300 : QMainWindow( parent ), m_actionCollection(this)
|
joachim99@8
|
301 {
|
joachim99@75
|
302 fileMenu = menuBar()->addMenu( i18n("&File") );
|
joachim99@75
|
303 editMenu = menuBar()->addMenu(i18n("&Edit") );
|
joachim99@75
|
304 directoryMenu = menuBar()->addMenu(i18n("&Directory") );
|
joachim99@51
|
305 dirCurrentItemMenu = 0;
|
joachim99@51
|
306 dirCurrentSyncItemMenu = 0;
|
joachim99@75
|
307 movementMenu = menuBar()->addMenu(i18n("&Movement") );
|
joachim99@75
|
308 diffMenu = menuBar()->addMenu(i18n("D&iffview") );
|
joachim99@75
|
309 mergeMenu = menuBar()->addMenu(i18n("&Merge") );
|
joachim99@75
|
310 windowsMenu = menuBar()->addMenu(i18n("&Window") );
|
joachim99@75
|
311 settingsMenu = menuBar()->addMenu(i18n("&Settings") );
|
joachim99@75
|
312 helpMenu = menuBar()->addMenu(i18n("&Help") );
|
joachim99@8
|
313
|
joachim99@8
|
314 m_pToolBar = new KToolBar(this);
|
joachim99@80
|
315 addToolBar( m_pToolBar );
|
joachim99@8
|
316
|
joachim99@70
|
317 memberList = new QList<KMainWindow*>;
|
joachim99@8
|
318 memberList->append(this);
|
joachim99@8
|
319 }
|
joachim99@8
|
320
|
joachim99@8
|
321 KToolBar* KMainWindow::toolBar(const QString&)
|
joachim99@8
|
322 {
|
joachim99@8
|
323 return m_pToolBar;
|
joachim99@8
|
324 }
|
joachim99@8
|
325
|
joachim99@8
|
326 KActionCollection* KMainWindow::actionCollection()
|
joachim99@8
|
327 {
|
joachim99@8
|
328 return &m_actionCollection;
|
joachim99@8
|
329 }
|
joachim99@8
|
330
|
joachim99@8
|
331 void KMainWindow::createGUI()
|
joachim99@8
|
332 {
|
joachim99@80
|
333 KStandardAction::help(this, SLOT(appHelpActivated()), actionCollection());
|
joachim99@80
|
334 KStandardAction::about(this, SLOT(slotAbout()), actionCollection());
|
joachim99@80
|
335 KStandardAction::aboutQt(actionCollection());
|
joachim99@8
|
336 }
|
joachim99@8
|
337
|
joachim99@8
|
338 void KMainWindow::slotAbout()
|
joachim99@8
|
339 {
|
joachim99@73
|
340 QDialog d;
|
joachim99@73
|
341 QVBoxLayout* l = new QVBoxLayout( &d );
|
joachim99@73
|
342 QTabWidget* pTabWidget = new QTabWidget;
|
joachim99@73
|
343 l->addWidget( pTabWidget );
|
joachim99@73
|
344
|
joachim99@73
|
345 QPushButton* pOkButton = new QPushButton(i18n("Ok"));
|
joachim99@73
|
346 connect( pOkButton, SIGNAL(clicked()), &d, SLOT(accept()));
|
joachim99@73
|
347 l->addWidget( pOkButton );
|
joachim99@73
|
348
|
joachim99@75
|
349 d.setWindowTitle("About " + s_appName);
|
joachim99@75
|
350 QTextBrowser* tb1 = new QTextBrowser();
|
joachim99@75
|
351 tb1->setWordWrapMode( QTextOption::NoWrap );
|
joachim99@66
|
352 tb1->setText(
|
joachim99@66
|
353 s_appName + " Version " + s_version +
|
joachim99@66
|
354 "\n\n" + s_description +
|
joachim99@66
|
355 "\n\n" + s_copyright +
|
joachim99@66
|
356 "\n\nHomepage: " + s_homepage +
|
joachim99@66
|
357 "\n\nLicence: GNU GPL Version 2"
|
joachim99@66
|
358 );
|
joachim99@73
|
359 pTabWidget->addTab(tb1,i18n("&About"));
|
joachim99@66
|
360
|
joachim99@66
|
361 std::list<KAboutData::AboutDataEntry>::iterator i;
|
joachim99@66
|
362
|
joachim99@66
|
363 QString s2;
|
joachim99@66
|
364 for( i=s_pAboutData->m_authorList.begin(); i!=s_pAboutData->m_authorList.end(); ++i )
|
joachim99@66
|
365 {
|
joachim99@66
|
366 if ( !i->m_name.isEmpty() ) s2 += i->m_name + "\n";
|
joachim99@66
|
367 if ( !i->m_task.isEmpty() ) s2 += " " + i->m_task + "\n";
|
joachim99@66
|
368 if ( !i->m_email.isEmpty() ) s2 += " " + i->m_email + "\n";
|
joachim99@66
|
369 if ( !i->m_weblink.isEmpty() ) s2 += " " + i->m_weblink + "\n";
|
joachim99@66
|
370 s2 += "\n";
|
joachim99@66
|
371 }
|
joachim99@75
|
372 QTextBrowser* tb2 = new QTextBrowser();
|
joachim99@75
|
373 tb2->setWordWrapMode( QTextOption::NoWrap );
|
joachim99@66
|
374 tb2->setText(s2);
|
joachim99@73
|
375 pTabWidget->addTab(tb2,i18n("A&uthor"));
|
joachim99@66
|
376
|
joachim99@66
|
377 QString s3;
|
joachim99@66
|
378 for( i=s_pAboutData->m_creditList.begin(); i!=s_pAboutData->m_creditList.end(); ++i )
|
joachim99@66
|
379 {
|
joachim99@66
|
380 if ( !i->m_name.isEmpty() ) s3 += i->m_name + "\n";
|
joachim99@66
|
381 if ( !i->m_task.isEmpty() ) s3 += " " + i->m_task + "\n";
|
joachim99@66
|
382 if ( !i->m_email.isEmpty() ) s3 += " " + i->m_email + "\n";
|
joachim99@66
|
383 if ( !i->m_weblink.isEmpty() ) s3 += " " + i->m_weblink + "\n";
|
joachim99@66
|
384 s3 += "\n";
|
joachim99@66
|
385 }
|
joachim99@75
|
386 QTextBrowser* tb3 = new QTextBrowser();
|
joachim99@75
|
387 tb3->setWordWrapMode( QTextOption::NoWrap );
|
joachim99@66
|
388 tb3->setText(s3);
|
joachim99@73
|
389 pTabWidget->addTab(tb3,i18n("&Thanks To"));
|
joachim99@66
|
390
|
joachim99@66
|
391 d.resize(400,300);
|
joachim99@66
|
392 d.exec();
|
joachim99@66
|
393 /*
|
joachim99@8
|
394 QMessageBox::information(
|
joachim99@8
|
395 this,
|
joachim99@8
|
396 "About " + s_appName,
|
joachim99@8
|
397 s_appName + " Version " + s_version +
|
joachim99@8
|
398 "\n\n" + s_description +
|
joachim99@8
|
399 "\n\n" + s_copyright +
|
joachim99@8
|
400 "\n\nHomepage: " + s_homepage +
|
joachim99@8
|
401 "\n\nLicence: GNU GPL Version 2"
|
joachim99@8
|
402 );
|
joachim99@66
|
403 */
|
joachim99@8
|
404 }
|
joachim99@8
|
405
|
joachim99@80
|
406 void KMainWindow::appHelpActivated()
|
joachim99@8
|
407 {
|
joachim99@8
|
408 showHelp();
|
joachim99@8
|
409 }
|
joachim99@8
|
410
|
joachim99@69
|
411
|
joachim99@69
|
412 QString KStandardDirs::findResource(const QString& resource, const QString& /*appName*/)
|
joachim99@69
|
413 {
|
joachim99@69
|
414 if (resource=="config")
|
joachim99@69
|
415 {
|
joachim99@75
|
416 QString home = QDir::homePath();
|
joachim99@69
|
417 return home + "/.kdiff3rc";
|
joachim99@69
|
418 }
|
joachim99@69
|
419 return QString();
|
joachim99@69
|
420 }
|
joachim99@69
|
421
|
joachim99@80
|
422 KConfigGroupData::~KConfigGroupData()
|
joachim99@8
|
423 {
|
joachim99@80
|
424 QFile f(m_fileName);
|
joachim99@80
|
425 if ( f.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
joachim99@8
|
426 { // file opened successfully
|
joachim99@80
|
427 QTextStream t( &f ); // use a text stream
|
joachim99@80
|
428 save(t);
|
joachim99@8
|
429 f.close();
|
joachim99@8
|
430 }
|
joachim99@8
|
431 }
|
joachim99@8
|
432
|
joachim99@80
|
433 KConfigGroup::KConfigGroup()
|
joachim99@8
|
434 {
|
joachim99@80
|
435 d = new KConfigGroupData;
|
joachim99@80
|
436 }
|
joachim99@80
|
437
|
joachim99@80
|
438 void KConfigGroup::readConfigFile( const QString& configFileName )
|
joachim99@80
|
439 {
|
joachim99@80
|
440 if ( !configFileName.isEmpty() )
|
joachim99@80
|
441 {
|
joachim99@80
|
442 d->m_fileName = configFileName;
|
joachim99@80
|
443 }
|
joachim99@80
|
444 else
|
joachim99@80
|
445 {
|
joachim99@80
|
446 d->m_fileName = KStandardDirs().findResource("config","kdiff3rc");
|
joachim99@80
|
447 }
|
joachim99@80
|
448
|
joachim99@80
|
449 QFile f( d->m_fileName );
|
joachim99@80
|
450 if ( f.open(QIODevice::ReadOnly) )
|
joachim99@8
|
451 { // file opened successfully
|
joachim99@80
|
452 QTextStream t( &f ); // use a text stream
|
joachim99@80
|
453 d->load(t);
|
joachim99@80
|
454 f.close();
|
joachim99@8
|
455 }
|
joachim99@8
|
456 }
|
joachim99@8
|
457
|
joachim99@80
|
458 KConfigGroup::~KConfigGroup()
|
joachim99@8
|
459 {
|
joachim99@8
|
460 }
|
joachim99@8
|
461
|
joachim99@80
|
462 void KConfigGroup::setGroup(const QString&)
|
joachim99@80
|
463 {
|
joachim99@80
|
464 }
|
joachim99@80
|
465
|
joachim99@80
|
466 KConfigGroup& KConfigGroup::group( const QString& )
|
joachim99@80
|
467 {
|
joachim99@80
|
468 KApplication* pKApp = static_cast<KApplication*>(QApplication::instance());
|
joachim99@80
|
469 return *pKApp->config();
|
joachim99@80
|
470 }
|
joachim99@80
|
471
|
joachim99@80
|
472 static void initAction( QAction* pAction, QObject* receiver, const char* slot, KActionCollection* actionCollection,
|
joachim99@80
|
473 const QString& name, bool bToggle, bool bMenu)
|
joachim99@8
|
474 {
|
joachim99@68
|
475 QString n(name);
|
joachim99@8
|
476 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@8
|
477 if( slot!=0 )
|
joachim99@8
|
478 {
|
joachim99@8
|
479 if (!bToggle)
|
joachim99@80
|
480 QObject::connect(pAction, SIGNAL(triggered()), receiver, slot);
|
joachim99@8
|
481 else
|
joachim99@8
|
482 {
|
joachim99@80
|
483 QObject::connect(pAction, SIGNAL(toggled(bool)), receiver, slot);
|
joachim99@8
|
484 }
|
joachim99@8
|
485 }
|
joachim99@8
|
486
|
joachim99@8
|
487 if (bMenu)
|
joachim99@8
|
488 {
|
joachim99@80
|
489 if( n[0]=='g') p->movementMenu->addAction( pAction );
|
joachim99@68
|
490 else if( n.left(16)=="dir_current_sync")
|
joachim99@53
|
491 {
|
joachim99@53
|
492 if ( p->dirCurrentItemMenu==0 )
|
joachim99@53
|
493 {
|
joachim99@75
|
494 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") );
|
joachim99@75
|
495 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") );
|
joachim99@53
|
496 }
|
joachim99@80
|
497 p->dirCurrentItemMenu->addAction( pAction );
|
joachim99@53
|
498 }
|
joachim99@68
|
499 else if( n.left(11)=="dir_current")
|
joachim99@53
|
500 {
|
joachim99@53
|
501 if ( p->dirCurrentItemMenu==0 )
|
joachim99@53
|
502 {
|
joachim99@75
|
503 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") );
|
joachim99@75
|
504 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") );
|
joachim99@53
|
505 }
|
joachim99@80
|
506 p->dirCurrentSyncItemMenu->addAction( pAction );
|
joachim99@53
|
507 }
|
joachim99@80
|
508 else if( n.left(4)=="diff") p->diffMenu->addAction( pAction );
|
joachim99@80
|
509 else if( name[0]=='d') p->directoryMenu->addAction( pAction );
|
joachim99@80
|
510 else if( name[0]=='f') p->fileMenu->addAction( pAction );
|
joachim99@80
|
511 else if( name[0]=='w') p->windowsMenu->addAction( pAction );
|
joachim99@80
|
512 else p->mergeMenu->addAction( pAction );
|
joachim99@8
|
513 }
|
joachim99@8
|
514 }
|
joachim99@8
|
515
|
joachim99@80
|
516 KAction::KAction(const QString& name, KActionCollection* actionCollection )
|
joachim99@80
|
517 : QAction ( actionCollection->m_pMainWindow )
|
joachim99@80
|
518 {
|
joachim99@80
|
519 initAction( this, 0,0, actionCollection, name, false, true );
|
joachim99@80
|
520 }
|
joachim99@80
|
521
|
joachim99@80
|
522 KAction::KAction( KActionCollection* actionCollection )
|
joachim99@80
|
523 : QAction ( actionCollection->m_pMainWindow )
|
joachim99@80
|
524 {
|
joachim99@80
|
525 }
|
joachim99@68
|
526
|
joachim99@70
|
527 KAction::KAction(const QString& text, const QIcon& icon, int accel,
|
joachim99@68
|
528 QObject* receiver, const char* slot, KActionCollection* actionCollection,
|
joachim99@68
|
529 const char* name, bool bToggle, bool bMenu
|
joachim99@68
|
530 )
|
joachim99@75
|
531 : QAction ( icon, text, actionCollection->m_pMainWindow )
|
joachim99@68
|
532 {
|
joachim99@75
|
533 setObjectName(name);
|
joachim99@75
|
534 setShortcut( accel );
|
joachim99@75
|
535 setCheckable( bToggle );
|
joachim99@68
|
536 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@75
|
537 if ( !icon.isNull() && p ) p->m_pToolBar->addAction( this );
|
joachim99@68
|
538
|
joachim99@80
|
539 initAction(this, receiver,slot,actionCollection,name,bToggle,bMenu);
|
joachim99@68
|
540 }
|
joachim99@68
|
541
|
joachim99@8
|
542 KAction::KAction(const QString& text, int accel,
|
joachim99@51
|
543 QObject* receiver, const char* slot, KActionCollection* actionCollection,
|
joachim99@68
|
544 const char* name, bool bToggle, bool bMenu
|
joachim99@8
|
545 )
|
joachim99@75
|
546 : QAction ( text, actionCollection->m_pMainWindow )
|
joachim99@8
|
547 {
|
joachim99@75
|
548 setObjectName(name);
|
joachim99@75
|
549 setShortcut( accel );
|
joachim99@75
|
550 setCheckable( bToggle );
|
joachim99@80
|
551 initAction(this,receiver,slot,actionCollection,name,bToggle,bMenu);
|
joachim99@8
|
552 }
|
joachim99@8
|
553
|
joachim99@8
|
554 void KAction::setStatusText(const QString&)
|
joachim99@8
|
555 {
|
joachim99@8
|
556 }
|
joachim99@8
|
557
|
joachim99@75
|
558 void KAction::plug(QMenu* menu)
|
joachim99@8
|
559 {
|
joachim99@75
|
560 menu->addAction( this );
|
joachim99@8
|
561 }
|
joachim99@8
|
562
|
joachim99@80
|
563 void KAction::setIcon( const QIcon& icon )
|
joachim99@80
|
564 {
|
joachim99@80
|
565 QAction::setIcon(icon);
|
joachim99@80
|
566 if ( !icon.isNull() )
|
joachim99@80
|
567 {
|
joachim99@80
|
568 KMainWindow* pMW = static_cast<KMainWindow*>( parent() );
|
joachim99@80
|
569 pMW->toolBar()->addAction(this);
|
joachim99@80
|
570 }
|
joachim99@80
|
571 }
|
joachim99@8
|
572
|
joachim99@80
|
573
|
joachim99@80
|
574 KToggleAction::KToggleAction( KActionCollection* actionCollection )
|
joachim99@80
|
575 : KAction( actionCollection )
|
joachim99@8
|
576 {
|
joachim99@80
|
577 setCheckable(true);
|
joachim99@8
|
578 }
|
joachim99@8
|
579
|
joachim99@68
|
580 KToggleAction::KToggleAction(const QString& text, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const char* name, bool bMenu)
|
joachim99@51
|
581 : KAction( text, accel, receiver, slot, actionCollection, name, true, bMenu)
|
joachim99@8
|
582 {
|
joachim99@8
|
583 }
|
joachim99@8
|
584
|
joachim99@70
|
585 KToggleAction::KToggleAction(const QString& text, const QIcon& icon, int accel, KActionCollection* actionCollection, const char* name, bool bMenu)
|
joachim99@8
|
586 : KAction( text, icon, accel, 0, 0, actionCollection, name, true, bMenu)
|
joachim99@8
|
587 {
|
joachim99@8
|
588 }
|
joachim99@8
|
589
|
joachim99@8
|
590 void KToggleAction::setChecked(bool bChecked)
|
joachim99@8
|
591 {
|
joachim99@8
|
592 blockSignals( true );
|
joachim99@75
|
593 QAction::setChecked( bChecked );
|
joachim99@8
|
594 blockSignals( false );
|
joachim99@8
|
595 }
|
joachim99@8
|
596
|
joachim99@8
|
597
|
joachim99@8
|
598 //static
|
joachim99@80
|
599 KAction* KStandardAction::open( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
600 {
|
joachim99@8
|
601 #include "../xpm/fileopen.xpm"
|
joachim99@8
|
602 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@70
|
603 KAction* a = new KAction( i18n("Open"), QIcon(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false);
|
joachim99@75
|
604 if(p){ p->fileMenu->addAction( a ); }
|
joachim99@8
|
605 return a;
|
joachim99@8
|
606 }
|
joachim99@8
|
607
|
joachim99@80
|
608 KAction* KStandardAction::save( QWidget* parent, const char* slot, KActionCollection* actionCollection )
|
joachim99@8
|
609 {
|
joachim99@8
|
610 #include "../xpm/filesave.xpm"
|
joachim99@8
|
611 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@70
|
612 KAction* a = new KAction( i18n("Save"), QIcon(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false);
|
joachim99@75
|
613 if(p){ p->fileMenu->addAction( a ); }
|
joachim99@8
|
614 return a;
|
joachim99@8
|
615 }
|
joachim99@8
|
616
|
joachim99@80
|
617 KAction* KStandardAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
618 {
|
joachim99@8
|
619 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
620 KAction* a = new KAction( i18n("Save As..."), 0, parent, slot, actionCollection, "saveas", false, false);
|
joachim99@75
|
621 if(p) p->fileMenu->addAction( a );
|
joachim99@8
|
622 return a;
|
joachim99@8
|
623 }
|
joachim99@8
|
624
|
joachim99@80
|
625 KAction* KStandardAction::print( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@69
|
626 {
|
joachim99@69
|
627 #include "../xpm/fileprint.xpm"
|
joachim99@69
|
628 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@70
|
629 KAction* a = new KAction( i18n("Print..."), QIcon(QPixmap(fileprint)),Qt::CTRL+Qt::Key_P, parent, slot, actionCollection, "print", false, false);
|
joachim99@75
|
630 if(p) p->fileMenu->addAction( a );
|
joachim99@69
|
631 return a;
|
joachim99@69
|
632 }
|
joachim99@69
|
633
|
joachim99@80
|
634 KAction* KStandardAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
635 {
|
joachim99@8
|
636 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
637 KAction* a = new KAction( i18n("Quit"), Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false);
|
joachim99@75
|
638 if(p) p->fileMenu->addAction( a );
|
joachim99@8
|
639 return a;
|
joachim99@8
|
640 }
|
joachim99@8
|
641
|
joachim99@80
|
642 KAction* KStandardAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
643 {
|
joachim99@8
|
644 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
645 KAction* a = new KAction( i18n("Cut"), Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false );
|
joachim99@75
|
646 if(p) p->editMenu->addAction( a );
|
joachim99@8
|
647 return a;
|
joachim99@8
|
648 }
|
joachim99@8
|
649
|
joachim99@80
|
650 KAction* KStandardAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
651 {
|
joachim99@8
|
652 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
653 KAction* a = new KAction( i18n("Copy"), Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false );
|
joachim99@75
|
654 if(p) p->editMenu->addAction( a );
|
joachim99@8
|
655 return a;
|
joachim99@8
|
656 }
|
joachim99@8
|
657
|
joachim99@80
|
658 KAction* KStandardAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
659 {
|
joachim99@8
|
660 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
661 KAction* a = new KAction( i18n("Paste"), Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false );
|
joachim99@75
|
662 if(p) p->editMenu->addAction( a );
|
joachim99@8
|
663 return a;
|
joachim99@8
|
664 }
|
joachim99@8
|
665
|
joachim99@80
|
666 KAction* KStandardAction::selectAll( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@69
|
667 {
|
joachim99@69
|
668 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@69
|
669 KAction* a = new KAction( i18n("Select All"), Qt::CTRL+Qt::Key_A, parent, slot, actionCollection, "selectall", false, false );
|
joachim99@75
|
670 if(p) p->editMenu->addAction( a );
|
joachim99@69
|
671 return a;
|
joachim99@69
|
672 }
|
joachim99@69
|
673
|
joachim99@80
|
674 KToggleAction* KStandardAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
675 {
|
joachim99@8
|
676 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
677 KToggleAction* a = new KToggleAction( i18n("Show Toolbar"), 0, parent, slot, actionCollection, "showtoolbar", false );
|
joachim99@75
|
678 if(p) p->settingsMenu->addAction( a );
|
joachim99@8
|
679 return a;
|
joachim99@8
|
680 }
|
joachim99@8
|
681
|
joachim99@80
|
682 KToggleAction* KStandardAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
683 {
|
joachim99@8
|
684 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
685 KToggleAction* a = new KToggleAction( i18n("Show &Statusbar"), 0, parent, slot, actionCollection, "showstatusbar", false );
|
joachim99@75
|
686 if(p) p->settingsMenu->addAction( a );
|
joachim99@8
|
687 return a;
|
joachim99@8
|
688 }
|
joachim99@8
|
689
|
joachim99@80
|
690 KAction* KStandardAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
691 {
|
joachim99@8
|
692 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@80
|
693 KAction* a = new KAction( i18n("&Configure %1...",QString("KDiff3")), 0, parent, slot, actionCollection, "settings", false, false );
|
joachim99@75
|
694 if(p) p->settingsMenu->addAction( a );
|
joachim99@8
|
695 return a;
|
joachim99@8
|
696 }
|
joachim99@80
|
697 KAction* KStandardAction::keyBindings( QWidget*, const char*, KActionCollection*)
|
joachim99@8
|
698 {
|
joachim99@8
|
699 return 0;
|
joachim99@8
|
700 }
|
joachim99@8
|
701
|
joachim99@80
|
702 KAction* KStandardAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
703 {
|
joachim99@8
|
704 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@69
|
705 KAction* a = new KAction( i18n("About")+" KDiff3", 0, parent, slot, actionCollection, "about_kdiff3", false, false );
|
joachim99@75
|
706 if(p) p->helpMenu->addAction( a );
|
joachim99@69
|
707 return a;
|
joachim99@69
|
708 }
|
joachim99@69
|
709
|
joachim99@80
|
710 KAction* KStandardAction::aboutQt( KActionCollection* actionCollection )
|
joachim99@69
|
711 {
|
joachim99@69
|
712 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@69
|
713 KAction* a = new KAction( i18n("About")+" Qt", 0, qApp, SLOT(aboutQt()), actionCollection, "about_qt", false, false );
|
joachim99@75
|
714 if(p) p->helpMenu->addAction( a );
|
joachim99@8
|
715 return a;
|
joachim99@8
|
716 }
|
joachim99@8
|
717
|
joachim99@80
|
718 KAction* KStandardAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
719 {
|
joachim99@8
|
720 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@80
|
721 KAction* a = new KAction( i18n("Help"), Qt::Key_F1, parent, slot, actionCollection, "help-contents", false, false );
|
joachim99@75
|
722 if(p) p->helpMenu->addAction( a );
|
joachim99@8
|
723 return a;
|
joachim99@8
|
724 }
|
joachim99@80
|
725 KAction* KStandardAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
726 {
|
joachim99@8
|
727 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@80
|
728 KAction* a = new KAction( i18n("Find"), Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "edit-find", false, false );
|
joachim99@75
|
729 if(p) p->editMenu->addAction( a );
|
joachim99@8
|
730 return a;
|
joachim99@8
|
731 }
|
joachim99@8
|
732
|
joachim99@80
|
733 KAction* KStandardAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection)
|
joachim99@8
|
734 {
|
joachim99@8
|
735 KMainWindow* p = actionCollection->m_pMainWindow;
|
joachim99@53
|
736 KAction* a = new KAction( i18n("Find Next"), Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false );
|
joachim99@75
|
737 if(p) p->editMenu->addAction( a );
|
joachim99@8
|
738 return a;
|
joachim99@8
|
739 }
|
joachim99@8
|
740
|
joachim99@80
|
741 KAction* KActionCollection::addAction(const QString& name )
|
joachim99@80
|
742 {
|
joachim99@80
|
743 return new KAction( name, this );
|
joachim99@80
|
744 }
|
joachim99@8
|
745
|
joachim99@80
|
746 void KActionCollection::addAction( const QString& name, QAction* pAction )
|
joachim99@80
|
747 {
|
joachim99@80
|
748 initAction( pAction, 0,0,this,name,false,true);
|
joachim99@80
|
749 }
|
joachim99@8
|
750
|
joachim99@80
|
751 KFontChooser::KFontChooser( QWidget* pParent )
|
joachim99@8
|
752 : QWidget(pParent)
|
joachim99@8
|
753 {
|
joachim99@8
|
754 m_pParent = pParent;
|
joachim99@75
|
755 QVBoxLayout* pLayout = new QVBoxLayout( this );
|
joachim99@53
|
756 m_pSelectFont = new QPushButton(i18n("Select Font"), this );
|
joachim99@8
|
757 connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont()));
|
joachim99@8
|
758 pLayout->addWidget(m_pSelectFont);
|
joachim99@8
|
759
|
joachim99@8
|
760 m_pLabel = new QLabel( "", this );
|
joachim99@8
|
761 m_pLabel->setFont( m_font );
|
joachim99@8
|
762 m_pLabel->setMinimumWidth(200);
|
joachim99@8
|
763 m_pLabel->setText( "The quick brown fox jumps over the river\n"
|
joachim99@8
|
764 "but the little red hen escapes with a shiver.\n"
|
joachim99@8
|
765 ":-)");
|
joachim99@8
|
766 pLayout->addWidget(m_pLabel);
|
joachim99@8
|
767 }
|
joachim99@8
|
768
|
joachim99@8
|
769 QFont KFontChooser::font()
|
joachim99@8
|
770 {
|
joachim99@8
|
771 return m_font;//QFont("courier",10);
|
joachim99@8
|
772 }
|
joachim99@8
|
773
|
joachim99@8
|
774 void KFontChooser::setFont( const QFont& font, bool )
|
joachim99@8
|
775 {
|
joachim99@8
|
776 m_font = font;
|
joachim99@8
|
777 m_pLabel->setFont( m_font );
|
joachim99@8
|
778 //update();
|
joachim99@8
|
779 }
|
joachim99@8
|
780
|
joachim99@8
|
781 void KFontChooser::slotSelectFont()
|
joachim99@8
|
782 {
|
joachim99@8
|
783 for(;;)
|
joachim99@8
|
784 {
|
joachim99@8
|
785 bool bOk;
|
joachim99@8
|
786 m_font = QFontDialog::getFont(&bOk, m_font );
|
joachim99@8
|
787 m_pLabel->setFont( m_font );
|
joachim99@8
|
788 QFontMetrics fm(m_font);
|
joachim99@8
|
789
|
joachim99@8
|
790 // Variable width font.
|
joachim99@8
|
791 if ( fm.width('W')!=fm.width('i') )
|
joachim99@8
|
792 {
|
joachim99@8
|
793 int result = KMessageBox::warningYesNo(m_pParent, i18n(
|
joachim99@8
|
794 "You selected a variable width font.\n\n"
|
joachim99@8
|
795 "Because this program doesn't handle variable width fonts\n"
|
joachim99@8
|
796 "correctly, you might experience problems while editing.\n\n"
|
joachim99@8
|
797 "Do you want to continue or do you want to select another font."),
|
joachim99@8
|
798 i18n("Incompatible font."),
|
joachim99@8
|
799 i18n("Continue at my own risk"), i18n("Select another font"));
|
joachim99@8
|
800 if (result==KMessageBox::Yes)
|
joachim99@8
|
801 return;
|
joachim99@8
|
802 }
|
joachim99@8
|
803 else
|
joachim99@8
|
804 return;
|
joachim99@8
|
805 }
|
joachim99@8
|
806 }
|
joachim99@8
|
807
|
joachim99@8
|
808
|
joachim99@8
|
809 KColorButton::KColorButton(QWidget* parent)
|
joachim99@8
|
810 : QPushButton(parent)
|
joachim99@8
|
811 {
|
joachim99@8
|
812 connect( this, SIGNAL(clicked()), this, SLOT(slotClicked()));
|
joachim99@8
|
813 }
|
joachim99@8
|
814
|
joachim99@8
|
815 QColor KColorButton::color()
|
joachim99@8
|
816 {
|
joachim99@8
|
817 return m_color;
|
joachim99@8
|
818 }
|
joachim99@8
|
819
|
joachim99@8
|
820 void KColorButton::setColor( const QColor& color )
|
joachim99@8
|
821 {
|
joachim99@8
|
822 m_color = color;
|
joachim99@8
|
823 update();
|
joachim99@8
|
824 }
|
joachim99@8
|
825
|
joachim99@8
|
826 void KColorButton::paintEvent( QPaintEvent* e )
|
joachim99@8
|
827 {
|
joachim99@8
|
828 QPushButton::paintEvent(e);
|
joachim99@8
|
829 QPainter p(this);
|
joachim99@8
|
830
|
joachim99@8
|
831 int w = width();
|
joachim99@8
|
832 int h = height();
|
joachim99@8
|
833 p.fillRect( 10, 5, w-20, h-10, m_color );
|
joachim99@8
|
834 p.drawRect( 10, 5, w-20, h-10 );
|
joachim99@8
|
835 }
|
joachim99@8
|
836
|
joachim99@8
|
837 void KColorButton::slotClicked()
|
joachim99@8
|
838 {
|
joachim99@8
|
839 // Under Windows ChooseColor() should be used. (Nicer if few colors exist.)
|
joachim99@8
|
840 QColor c = QColorDialog::getColor ( m_color, this );
|
joachim99@8
|
841 if ( c.isValid() ) m_color = c;
|
joachim99@8
|
842 update();
|
joachim99@8
|
843 }
|
joachim99@8
|
844
|
joachim99@69
|
845 KPrinter::KPrinter()
|
joachim99@69
|
846 {
|
joachim99@69
|
847 }
|
joachim99@75
|
848 QList<int> KPrinter::pageList()
|
joachim99@69
|
849 {
|
joachim99@75
|
850 QList<int> vl;
|
joachim99@69
|
851 int to = toPage();
|
joachim99@69
|
852 for(int i=fromPage(); i<=to; ++i)
|
joachim99@69
|
853 {
|
joachim99@69
|
854 vl.push_back(i);
|
joachim99@69
|
855 }
|
joachim99@69
|
856 return vl;
|
joachim99@69
|
857 }
|
joachim99@69
|
858 void KPrinter::setCurrentPage(int)
|
joachim99@69
|
859 {
|
joachim99@69
|
860 }
|
joachim99@69
|
861 void KPrinter::setPageSelection(e_PageSelection)
|
joachim99@69
|
862 {
|
joachim99@69
|
863 }
|
joachim99@69
|
864
|
joachim99@69
|
865
|
joachim99@80
|
866 QPixmap KIconLoader::loadIcon( const QString&, int, int )
|
joachim99@8
|
867 {
|
joachim99@8
|
868 return QPixmap();
|
joachim99@8
|
869 }
|
joachim99@8
|
870
|
joachim99@80
|
871 KAboutData::KAboutData(const QByteArray &appName, const QByteArray & /*catalogName*/, const KLocalizedString & /*programName*/,
|
joachim99@80
|
872 const QByteArray &version, const KLocalizedString &shortDescription, LicenseKey /*licenseType*/,
|
joachim99@80
|
873 const KLocalizedString ©rightStatement, const KLocalizedString & /*text*/,
|
joachim99@80
|
874 const QByteArray &homePageAddress, const QByteArray &bugsEmailAddress)
|
joachim99@8
|
875 {
|
joachim99@80
|
876 s_copyright = copyrightStatement;
|
joachim99@80
|
877 s_email = bugsEmailAddress;
|
joachim99@8
|
878 s_appName = appName;
|
joachim99@80
|
879 s_description = shortDescription;
|
joachim99@8
|
880 s_version = version;
|
joachim99@80
|
881 s_homepage = homePageAddress;
|
joachim99@8
|
882 }
|
joachim99@8
|
883
|
joachim99@80
|
884 KAboutData::KAboutData( const QString& /*name*/, const QString& /*appName*/, const QString& /*appName2*/, const QString& /*version*/ )
|
joachim99@8
|
885 {
|
joachim99@8
|
886 }
|
joachim99@8
|
887
|
joachim99@80
|
888 void KAboutData::addAuthor(const QString& name, const QString& task, const QString& email, const QString& weblink)
|
joachim99@8
|
889 {
|
joachim99@66
|
890 m_authorList.push_back( AboutDataEntry( name, task, email, weblink) );
|
joachim99@66
|
891 }
|
joachim99@66
|
892
|
joachim99@80
|
893 void KAboutData::addCredit(const QString& name, const QString& task, const QString& email, const QString& weblink)
|
joachim99@66
|
894 {
|
joachim99@66
|
895 m_creditList.push_back( AboutDataEntry( name, task, email, weblink) );
|
joachim99@8
|
896 }
|
joachim99@8
|
897
|
joachim99@8
|
898 /* Option structure: e.g.:
|
joachim99@8
|
899 { "m", 0, 0 },
|
joachim99@8
|
900 { "merge", I18N_NOOP("Automatically merge the input."), 0 },
|
joachim99@8
|
901 { "o", 0, 0 },
|
joachim99@8
|
902 { "output file", I18N_NOOP("Output file. Implies -m. E.g.: -o newfile.txt"), 0 },
|
joachim99@8
|
903 { "+[File1]", I18N_NOOP("file1 to open (base)"), 0 },
|
joachim99@8
|
904 { "+[File2]", I18N_NOOP("file2 to open"), 0 },
|
joachim99@8
|
905 { "+[File3]", I18N_NOOP("file3 to open"), 0 },
|
joachim99@8
|
906 */
|
joachim99@8
|
907 ////////////////
|
joachim99@8
|
908 static KCmdLineArgs s_cmdLineArgs;
|
joachim99@8
|
909 static int s_argc;
|
joachim99@8
|
910 static char** s_argv;
|
joachim99@80
|
911
|
joachim99@80
|
912 struct KCmdLineOptionsItem
|
joachim99@80
|
913 {
|
joachim99@80
|
914 QString name;
|
joachim99@80
|
915 QString description;
|
joachim99@80
|
916 int def;
|
joachim99@80
|
917 };
|
joachim99@80
|
918 static QList<KCmdLineOptionsItem> s_options;
|
joachim99@8
|
919
|
joachim99@8
|
920 static std::vector<QCStringList> s_vOption;
|
joachim99@80
|
921 static std::vector<QString> s_vArg;
|
joachim99@80
|
922
|
joachim99@80
|
923 KCmdLineOptions& KCmdLineOptions::add( const QString& name, const QString& description )
|
joachim99@80
|
924 {
|
joachim99@80
|
925 KCmdLineOptionsItem i;
|
joachim99@80
|
926 i.name = name;
|
joachim99@80
|
927 i.description = description;
|
joachim99@80
|
928 i.def = 0;
|
joachim99@80
|
929 s_options.push_back(i);
|
joachim99@80
|
930 return *this;
|
joachim99@80
|
931 }
|
joachim99@8
|
932
|
joachim99@8
|
933 KCmdLineArgs* KCmdLineArgs::parsedArgs() // static
|
joachim99@8
|
934 {
|
joachim99@51
|
935 return &s_cmdLineArgs;
|
joachim99@8
|
936 }
|
joachim99@8
|
937
|
joachim99@66
|
938 void KCmdLineArgs::init( int argc, char**argv, KAboutData* pAboutData ) // static
|
joachim99@8
|
939 {
|
joachim99@8
|
940 s_argc = argc;
|
joachim99@8
|
941 s_argv = argv;
|
joachim99@66
|
942 s_pAboutData = pAboutData;
|
joachim99@8
|
943 }
|
joachim99@8
|
944
|
joachim99@80
|
945 void KCmdLineArgs::addCmdLineOptions( const KCmdLineOptions& /*options*/ ) // static
|
joachim99@8
|
946 {
|
joachim99@80
|
947 //s_pOptions = &options;
|
joachim99@8
|
948 }
|
joachim99@8
|
949
|
joachim99@8
|
950 int KCmdLineArgs::count()
|
joachim99@8
|
951 {
|
joachim99@8
|
952 return s_vArg.size();
|
joachim99@8
|
953 }
|
joachim99@8
|
954
|
joachim99@8
|
955 QString KCmdLineArgs::arg(int idx)
|
joachim99@8
|
956 {
|
joachim99@80
|
957 return s_vArg[idx];
|
joachim99@8
|
958 }
|
joachim99@8
|
959
|
joachim99@8
|
960 void KCmdLineArgs::clear()
|
joachim99@8
|
961 {
|
joachim99@8
|
962 }
|
joachim99@8
|
963
|
joachim99@8
|
964 QString KCmdLineArgs::getOption( const QString& s )
|
joachim99@8
|
965 {
|
joachim99@8
|
966 // Find the option
|
joachim99@8
|
967 int j=0;
|
joachim99@8
|
968 for( j=0; j<(int)s_vOption.size(); ++j )
|
joachim99@8
|
969 {
|
joachim99@80
|
970 QString optName = s_options[j].name;
|
joachim99@80
|
971 int pos = optName.indexOf( ' ' );
|
joachim99@80
|
972 int len = pos==-1 ? optName.length() : pos;
|
joachim99@8
|
973
|
joachim99@80
|
974 if( s == optName.left( len ) )
|
joachim99@8
|
975 {
|
joachim99@8
|
976 return s_vOption[j].isEmpty() ? QString() : s_vOption[j].last();
|
joachim99@8
|
977 }
|
joachim99@8
|
978 }
|
joachim99@8
|
979 assert(false);
|
joachim99@8
|
980 return QString();
|
joachim99@8
|
981 }
|
joachim99@8
|
982
|
joachim99@80
|
983 QStringList KCmdLineArgs::getOptionList( const QString& s )
|
joachim99@8
|
984 {
|
joachim99@8
|
985 // Find the option
|
joachim99@8
|
986 int j=0;
|
joachim99@8
|
987 for( j=0; j<(int)s_vOption.size(); ++j )
|
joachim99@8
|
988 {
|
joachim99@80
|
989 QString optName = s_options[j].name;
|
joachim99@80
|
990 int pos = optName.indexOf( ' ' );
|
joachim99@80
|
991 int len = pos==-1 ? optName.length() : pos;
|
joachim99@8
|
992
|
joachim99@80
|
993 if( s == optName.left( len ) )
|
joachim99@8
|
994 {
|
joachim99@8
|
995 return s_vOption[j];
|
joachim99@8
|
996 }
|
joachim99@8
|
997 }
|
joachim99@8
|
998
|
joachim99@8
|
999 assert(false);
|
joachim99@80
|
1000 return QStringList();
|
joachim99@8
|
1001 }
|
joachim99@8
|
1002
|
joachim99@8
|
1003 bool KCmdLineArgs::isSet(const QString& s)
|
joachim99@8
|
1004 {
|
joachim99@8
|
1005 // Find the option
|
joachim99@8
|
1006 int j=0;
|
joachim99@8
|
1007 for( j=0; j<(int)s_vOption.size(); ++j )
|
joachim99@8
|
1008 {
|
joachim99@80
|
1009 QString optName = s_options[j].name;
|
joachim99@80
|
1010 if( s == optName )
|
joachim99@8
|
1011 {
|
joachim99@8
|
1012 return ! s_vOption[j].isEmpty();
|
joachim99@8
|
1013 }
|
joachim99@8
|
1014 }
|
joachim99@8
|
1015 assert(false);
|
joachim99@8
|
1016 return false;
|
joachim99@8
|
1017 }
|
joachim99@8
|
1018
|
joachim99@80
|
1019
|
joachim99@8
|
1020 ///////////////////
|
joachim99@8
|
1021 KApplication* kapp;
|
joachim99@8
|
1022
|
joachim99@8
|
1023 KApplication::KApplication()
|
joachim99@8
|
1024 : QApplication( s_argc,s_argv )
|
joachim99@8
|
1025 {
|
joachim99@8
|
1026 kapp = this;
|
joachim99@8
|
1027
|
joachim99@80
|
1028 //setStyle( new QWindowsStyle ); // doesn't show checkmarks on checkable icons in menu
|
joachim99@80
|
1029
|
joachim99@8
|
1030 int nofOptions=0;
|
joachim99@8
|
1031 int nofArgs=0;
|
joachim99@8
|
1032 int i=0;
|
joachim99@80
|
1033 while( i < s_options.size() )
|
joachim99@8
|
1034 {
|
joachim99@80
|
1035 if ( s_options[i].name[0]=='[' )
|
joachim99@8
|
1036 nofArgs++;
|
joachim99@8
|
1037 else
|
joachim99@8
|
1038 nofOptions++;
|
joachim99@8
|
1039
|
joachim99@8
|
1040 ++i;
|
joachim99@8
|
1041 }
|
joachim99@8
|
1042
|
joachim99@69
|
1043 // First find the option "-config" or "--config" to allow loading of options
|
joachim99@69
|
1044 QString configFileName;
|
joachim99@69
|
1045 for( i=1; i<s_argc-1; ++i )
|
joachim99@69
|
1046 {
|
joachim99@69
|
1047 QString arg = s_argv[i];
|
joachim99@69
|
1048 if ( arg == "-config" || arg == "--config" )
|
joachim99@69
|
1049 {
|
joachim99@69
|
1050 configFileName = s_argv[i+1];
|
joachim99@69
|
1051 }
|
joachim99@69
|
1052 }
|
joachim99@69
|
1053 m_config.readConfigFile(configFileName);
|
joachim99@69
|
1054
|
joachim99@80
|
1055 QStringList ignorableCmdLineOptionsList = m_config.readEntry("IgnorableCmdLineOptions", QStringList("-u;-query;-html;-abort"), '|');
|
joachim99@69
|
1056 QString ignorableCmdLineOptions;
|
joachim99@69
|
1057 if ( !ignorableCmdLineOptionsList.isEmpty() )
|
joachim99@69
|
1058 ignorableCmdLineOptions = ignorableCmdLineOptionsList.front() + ";";
|
joachim99@69
|
1059
|
joachim99@8
|
1060 s_vOption.resize(nofOptions);
|
joachim99@8
|
1061
|
joachim99@8
|
1062 for( i=1; i<s_argc; ++i )
|
joachim99@8
|
1063 {
|
joachim99@80
|
1064 QString arg = s_argv[i];
|
joachim99@80
|
1065 if ( arg[0]=='-' ) // An option
|
joachim99@8
|
1066 {
|
joachim99@80
|
1067 if ( ignorableCmdLineOptions.contains( arg +";") )
|
joachim99@69
|
1068 continue;
|
joachim99@8
|
1069 // Find the option
|
joachim99@8
|
1070 int j=0;
|
joachim99@8
|
1071 for( j=0; j<nofOptions; ++j )
|
joachim99@8
|
1072 {
|
joachim99@80
|
1073 QString optName = s_options[j].name;
|
joachim99@80
|
1074 int pos = optName.indexOf( ' ' );
|
joachim99@80
|
1075 int len = pos==-1 ? optName.length() : pos;
|
joachim99@80
|
1076 int len2 = arg.length();
|
joachim99@8
|
1077
|
joachim99@80
|
1078 if( len>0 && ( arg[1]=='-' && len2-2==len && optName.left(len) == arg.mid(2,len) ||
|
joachim99@80
|
1079 len2-1==len && optName.left(len) == arg.mid(1,len) ))
|
joachim99@8
|
1080 {
|
joachim99@80
|
1081 if (s_options[j].description == 0) // alias, because without description.
|
joachim99@8
|
1082 {
|
joachim99@8
|
1083 ++j;
|
joachim99@80
|
1084 optName = s_options[j].name;
|
joachim99@80
|
1085 pos = optName.indexOf( ' ' );
|
joachim99@8
|
1086 }
|
joachim99@80
|
1087 if (pos!=-1){ ++i; s_vOption[j].append( s_argv[i] ); } //use param
|
joachim99@80
|
1088 else { s_vOption[j].append("1"); } //set state
|
joachim99@8
|
1089 break;
|
joachim99@8
|
1090 }
|
joachim99@8
|
1091 }
|
joachim99@8
|
1092 if (j==nofOptions)
|
joachim99@8
|
1093 {
|
joachim99@58
|
1094 QString s;
|
joachim99@80
|
1095 s = QString("Unknown option: ") + arg + "\n";
|
joachim99@69
|
1096 s += "If KDiff3 should ignore this option, run KDiff3 normally and edit\n"
|
joachim99@69
|
1097 "the \"Command line options to ignore\" in the \"Integration Settings\".\n\n";
|
joachim99@8
|
1098
|
joachim99@58
|
1099 s += "KDiff3-Usage when starting via commandline: \n";
|
joachim99@58
|
1100 s += "- Comparing 2 files:\t\tkdiff3 file1 file2\n";
|
joachim99@58
|
1101 s += "- Merging 2 files: \t\tkdiff3 file1 file2 -o outputfile\n";
|
joachim99@58
|
1102 s += "- Comparing 3 files:\t\tkdiff3 file1 file2 file3\n";
|
joachim99@58
|
1103 s += "- Merging 3 files: \t\tkdiff3 file1 file2 file3 -o outputfile\n";
|
joachim99@58
|
1104 s += " Note that file1 will be treated as base of file2 and file3.\n";
|
joachim99@58
|
1105 s += "\n";
|
joachim99@58
|
1106 s += "If you start without arguments, then a dialog will appear\n";
|
joachim99@58
|
1107 s += "where you can select your files via a filebrowser.\n";
|
joachim99@58
|
1108 s += "\n";
|
joachim99@66
|
1109
|
joachim99@66
|
1110 s += "Options:\n";
|
joachim99@66
|
1111
|
joachim99@66
|
1112 j=0;
|
joachim99@66
|
1113 int pos=s.length();
|
joachim99@66
|
1114 for( j=0; j<nofOptions; ++j )
|
joachim99@66
|
1115 {
|
joachim99@80
|
1116 if ( s_options[j].description!=0 )
|
joachim99@66
|
1117 {
|
joachim99@80
|
1118 if (s_options[j].name[0]!='+')
|
joachim99@66
|
1119 {
|
joachim99@66
|
1120 s += "-";
|
joachim99@80
|
1121 if ( s_options[j].name.length()>1 ) s += "-";
|
joachim99@66
|
1122 }
|
joachim99@80
|
1123 s += s_options[j].name;
|
joachim99@66
|
1124 s += QString().fill(' ', minMaxLimiter( 20 - ((int)s.length()-pos), 3, 20 ) );
|
joachim99@80
|
1125 s += s_options[j].description;
|
joachim99@66
|
1126 s +="\n";
|
joachim99@66
|
1127 pos=s.length();
|
joachim99@66
|
1128 }
|
joachim99@66
|
1129 else
|
joachim99@66
|
1130 {
|
joachim99@66
|
1131 s += "-";
|
joachim99@80
|
1132 if ( s_options[j].name.length()>1 ) s += "-";
|
joachim99@80
|
1133 s += s_options[j].name;
|
joachim99@66
|
1134 s += ", ";
|
joachim99@66
|
1135 }
|
joachim99@66
|
1136 }
|
joachim99@69
|
1137
|
joachim99@69
|
1138 s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n";
|
joachim99@69
|
1139 #ifdef _WIN32
|
joachim99@58
|
1140 // A windows program has no console
|
joachim99@69
|
1141 if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) )
|
joachim99@69
|
1142 continue;
|
joachim99@58
|
1143 #else
|
joachim99@75
|
1144 std::cerr << s.toLatin1().constData() << std::endl;
|
joachim99@58
|
1145 #endif
|
joachim99@69
|
1146
|
joachim99@8
|
1147 ::exit(-1);
|
joachim99@8
|
1148 }
|
joachim99@8
|
1149 }
|
joachim99@8
|
1150 else
|
joachim99@80
|
1151 s_vArg.push_back( arg );
|
joachim99@8
|
1152 }
|
joachim99@8
|
1153 }
|
joachim99@8
|
1154
|
joachim99@80
|
1155 KConfigGroup* KApplication::config()
|
joachim99@8
|
1156 {
|
joachim99@8
|
1157 return &m_config;
|
joachim99@8
|
1158 }
|
joachim99@8
|
1159
|
joachim99@8
|
1160 bool KApplication::isRestored()
|
joachim99@8
|
1161 {
|
joachim99@8
|
1162 return false;
|
joachim99@8
|
1163 }
|
joachim99@8
|
1164
|
joachim99@8
|
1165 KApplication* KApplication::kApplication()
|
joachim99@8
|
1166 {
|
joachim99@8
|
1167 return kapp;
|
joachim99@8
|
1168 }
|
joachim99@8
|
1169
|
joachim99@8
|
1170 KIconLoader* KApplication::iconLoader()
|
joachim99@8
|
1171 {
|
joachim99@8
|
1172 return &m_iconLoader;
|
joachim99@8
|
1173 }
|
joachim99@8
|
1174
|
joachim99@8
|
1175
|
joachim99@8
|
1176 namespace KIO
|
joachim99@8
|
1177 {
|
joachim99@80
|
1178 SimpleJob* mkdir( KUrl ){return 0;}
|
joachim99@80
|
1179 SimpleJob* rmdir( KUrl ){return 0;}
|
joachim99@80
|
1180 SimpleJob* file_delete( KUrl, int ){return 0;}
|
joachim99@80
|
1181 FileCopyJob* file_move( KUrl, KUrl, int, int ) {return 0;}
|
joachim99@80
|
1182 FileCopyJob* file_copy( KUrl, KUrl, int, int ) {return 0;}
|
joachim99@80
|
1183 CopyJob* link( KUrl, KUrl, bool ) {return 0;}
|
joachim99@80
|
1184 ListJob* listRecursive( KUrl, bool, bool ){return 0;}
|
joachim99@80
|
1185 ListJob* listDir( KUrl, bool, bool ){return 0;}
|
joachim99@80
|
1186 StatJob* stat( KUrl, bool, int, int ){return 0;}
|
joachim99@80
|
1187 TransferJob* get( KUrl, int ){return (TransferJob*)0;}
|
joachim99@80
|
1188 TransferJob* put( KUrl, int, int ){return (TransferJob*)0;}
|
joachim99@8
|
1189 };
|
joachim99@8
|
1190
|
joachim99@8
|
1191 KActionCollection* KParts::Part::actionCollection()
|
joachim99@8
|
1192 {
|
joachim99@8
|
1193 return 0;
|
joachim99@8
|
1194 }
|
joachim99@8
|
1195
|
joachim99@8
|
1196 KApplication* KParts::Part::instance()
|
joachim99@8
|
1197 {
|
joachim99@8
|
1198 return kapp;
|
joachim99@8
|
1199 }
|
joachim99@8
|
1200
|
joachim99@8
|
1201
|
joachim99@8
|
1202 KLibLoader* KLibLoader::self()
|
joachim99@8
|
1203 {
|
joachim99@8
|
1204 static KLibLoader ll;
|
joachim99@8
|
1205 return ≪
|
joachim99@8
|
1206 }
|
joachim99@8
|
1207
|
joachim99@8
|
1208 extern "C" void* init_libkdiff3part();
|
joachim99@8
|
1209 KLibFactory* KLibLoader::factory(QString const&)
|
joachim99@8
|
1210 {
|
joachim99@8
|
1211 return (KLibFactory*) init_libkdiff3part();
|
joachim99@8
|
1212 }
|
joachim99@8
|
1213
|
joachim99@68
|
1214 QObject* KLibFactory::create(QObject* pParent, const QString& name, const QString& classname )
|
joachim99@8
|
1215 {
|
joachim99@8
|
1216 KParts::Factory* f = dynamic_cast<KParts::Factory*>(this);
|
joachim99@8
|
1217 if (f!=0)
|
joachim99@75
|
1218 return f->createPartObject( (QWidget*)pParent, name.toAscii(),
|
joachim99@75
|
1219 pParent, name.toAscii(),
|
joachim99@75
|
1220 classname.toAscii(), QStringList() );
|
joachim99@8
|
1221 else
|
joachim99@8
|
1222 return 0;
|
joachim99@8
|
1223 }
|
joachim99@8
|
1224
|
joachim99@8
|
1225
|
joachim99@8
|
1226
|
joachim99@58
|
1227
|
joachim99@80
|
1228 //#include "kreplacements.moc"
|