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