comparison kdiff3/src-QT4/kreplacements/kreplacements.cpp @ 80:fcd146072e0c

0.9.93
author joachim99
date Tue, 06 Jan 2009 17:51:29 +0000
parents 08ea9b86c12c
children 4e6ebbbae925
comparison
equal deleted inserted replaced
79:881e47f5076b 80:fcd146072e0c
96 pBrowser->show(); 96 pBrowser->show();
97 } 97 }
98 else 98 else
99 { 99 {
100 QFileInfo prog( buf ); 100 QFileInfo prog( buf );
101 //_spawnlp( _P_NOWAIT , prog.filePath().toAscii(), prog.fileName().toAscii(), (""+.absFilePath()).toAscii(), NULL ); 101 QProcess::startDetached ( prog.filePath(), QStringList( "file:///"+helpFile.absoluteFilePath() ) );
102 QProcess::startDetached ( prog.filePath() + " \"file:///" + helpFile.absolutePath() + "\"" );
103 } 102 }
104 103
105 #else 104 #else
106 static QTextBrowser* pBrowser = 0; 105 static QTextBrowser* pBrowser = 0;
107 if (pBrowser==0) 106 if (pBrowser==0)
115 } 114 }
116 115
117 QString getTranslationDir() 116 QString getTranslationDir()
118 { 117 {
119 #ifdef _WIN32 118 #ifdef _WIN32
120 char buf[200]; 119 wchar_t buf[200];
121 int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 ); 120 int r= SearchPathW( 0, L".", 0, sizeof(buf)/sizeof(wchar_t), buf, 0 );
122 121
122 buf[ sizeof(buf)/sizeof(wchar_t) -1 ] = 0;
123 QString exePath; 123 QString exePath;
124 if (r!=0) { exePath = buf; } 124 if (r!=0) { exePath = QString::fromUtf16( (ushort*)&buf[0] ); }
125 else { exePath = "."; } 125 else { exePath = "."; }
126 return exePath+"/translations"; 126 return exePath+"/translations";
127 #else 127 #else
128 return "."; 128 return ".";
129 #endif 129 #endif
166 if ( val==1 ) return No; 166 if ( val==1 ) return No;
167 else return Cancel; 167 else return Cancel;
168 } 168 }
169 169
170 170
171 KDialogBase::KDialogBase( int, const QString& caption, int, int, QWidget* parent, const char* name, 171 KPageDialog::KPageDialog( QWidget* parent )
172 bool /*modal*/, bool )
173 : QDialog( parent ) 172 : QDialog( parent )
174 { 173 {
175 setObjectName(name);
176 setModal(true); 174 setModal(true);
177 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 175 QVBoxLayout *pMainLayout = new QVBoxLayout(this);
178 m_pTabWidget = new QTabWidget(); 176 m_pTabWidget = new QTabWidget();
179 pMainLayout->addWidget(m_pTabWidget,1); 177 pMainLayout->addWidget(m_pTabWidget,1);
180 178
181 QHBoxLayout* pButtonLayout = new QHBoxLayout(); 179 QHBoxLayout* pButtonLayout = new QHBoxLayout();
182 pMainLayout->addLayout( pButtonLayout ); 180 pMainLayout->addLayout( pButtonLayout );
183 181
184 pButtonLayout->addStretch(1); 182 pButtonLayout->addStretch(1);
185 QPushButton* pOk = new QPushButton( i18n("Ok") ); 183 QPushButton* pOk = new QPushButton( i18n("Ok") );
186 connect( pOk, SIGNAL( clicked() ), this, SLOT(accept()) ); 184 connect( pOk, SIGNAL( clicked() ), this, SIGNAL(okClicked()) );
187 pButtonLayout->addWidget( pOk ); 185 pButtonLayout->addWidget( pOk );
188 186
189 QPushButton* pHelp = new QPushButton( i18n("Help") ); 187 QPushButton* pHelp = new QPushButton( i18n("Help") );
190 connect( pHelp, SIGNAL( clicked() ), this, SLOT(slotHelp())); 188 connect( pHelp, SIGNAL( clicked() ), this, SLOT(slotHelpClicked()));
191 pButtonLayout->addWidget( pHelp ); 189 pButtonLayout->addWidget( pHelp );
192 190
193 QPushButton* pDefaults = new QPushButton( i18n("Defaults") ); 191 QPushButton* pDefaults = new QPushButton( i18n("Defaults") );
194 connect( pDefaults, SIGNAL( clicked() ), this, SLOT(slotDefault()) ); 192 connect( pDefaults, SIGNAL( clicked() ), this, SIGNAL(defaultClicked()) );
195 pButtonLayout->addWidget( pDefaults ); 193 pButtonLayout->addWidget( pDefaults );
196 194
197 QPushButton* pCancel = new QPushButton( i18n("Cancel") ); 195 QPushButton* pCancel = new QPushButton( i18n("Cancel") );
198 connect( pCancel, SIGNAL( clicked() ), this, SLOT(reject())); 196 connect( pCancel, SIGNAL( clicked() ), this, SLOT(reject()));
199 pButtonLayout->addWidget( pCancel ); 197 pButtonLayout->addWidget( pCancel );
200 198 }
201 setWindowTitle( caption ); 199
202 } 200 KPageDialog::~KPageDialog()
203 201 {
204 KDialogBase::~KDialogBase() 202 }
205 { 203
206 } 204 void KPageDialog::incrementInitialSize ( const QSize& )
207 205 {
208 void KDialogBase::incInitialSize ( const QSize& ) 206 }
209 { 207
210 } 208 void KPageDialog::setHelp(const QString&, const QString& )
211 209 {
212 void KDialogBase::setHelp(const QString&, const QString& ) 210 }
213 { 211
214 } 212 void KPageDialog::slotHelpClicked()
215 213 {
216 214 showHelp();
217 int KDialogBase::BarIcon(const QString& /*iconName*/, int ) 215 }
216
217 int KPageDialog::BarIcon(const QString& /*iconName*/, int )
218 { 218 {
219 return 0; // Not used for replacement. 219 return 0; // Not used for replacement.
220 } 220 }
221 221
222 222
223 QFrame* KDialogBase::addPage( const QString& name, const QString& /*info*/, int ) 223 QFrame* KPageDialog::addPage( const QString& name, const QString& /*info*/, int )
224 { 224 {
225 QFrame* p = new QFrame(); 225 QFrame* p = new QFrame();
226 p->setObjectName( name ); 226 p->setObjectName( name );
227 m_pTabWidget->addTab( p, name ); 227 m_pTabWidget->addTab( p, name );
228 return p; 228 return p;
229 } 229 }
230 230
231 int KDialogBase::spacingHint() 231 void KPageDialog::addPage( KPageWidgetItem * p )
232 {
233 m_pTabWidget->addTab( p->m_pWidget, p->m_title );
234 }
235
236 int KPageDialog::spacingHint()
232 { 237 {
233 return 3; 238 return 3;
234 } 239 }
235 240
236 static bool s_inAccept = false; 241 KUrl KFileDialog::getSaveUrl( const QString &startDir,
237 static bool s_bAccepted = false;
238 void KDialogBase::accept()
239 {
240 if( ! s_inAccept )
241 {
242 s_bAccepted = false;
243 s_inAccept = true;
244 slotOk();
245 s_inAccept = false;
246 if ( s_bAccepted )
247 QDialog::accept();
248 }
249 else
250 {
251 s_bAccepted = true;
252 }
253 }
254
255 void KDialogBase::slotDefault( )
256 {
257 }
258 void KDialogBase::slotOk()
259 {
260 }
261 void KDialogBase::slotCancel( )
262 {
263 }
264 void KDialogBase::slotApply( )
265 {
266 emit applyClicked();
267 }
268 void KDialogBase::slotHelp( )
269 {
270 showHelp();
271 }
272
273 KURL KFileDialog::getSaveURL( const QString &startDir,
274 const QString &filter, 242 const QString &filter,
275 QWidget *parent, const QString &caption) 243 QWidget *parent, const QString &caption)
276 { 244 {
277 QString s = QFileDialog::getSaveFileName(parent, caption, startDir, filter, 0/*, QFileDialog::DontUseNativeDialog*/); 245 QString s = QFileDialog::getSaveFileName(parent, caption, startDir, filter, 0/*, QFileDialog::DontUseNativeDialog*/);
278 return KURL(s); 246 return KUrl(s);
279 } 247 }
280 248
281 KURL KFileDialog::getOpenURL( const QString & startDir, 249 KUrl KFileDialog::getOpenUrl( const QString & startDir,
282 const QString & filter, 250 const QString & filter,
283 QWidget * parent, 251 QWidget * parent,
284 const QString & caption ) 252 const QString & caption )
285 { 253 {
286 QString s = QFileDialog::getOpenFileName(parent, caption, startDir, filter ); 254 QString s = QFileDialog::getOpenFileName(parent, caption, startDir, filter );
287 return KURL(s); 255 return KUrl(s);
288 } 256 }
289 257
290 KURL KFileDialog::getExistingURL( const QString & startDir, 258 KUrl KFileDialog::getExistingDirectoryUrl( const QString & startDir,
291 QWidget * parent, 259 QWidget * parent,
292 const QString & caption) 260 const QString & caption)
293 { 261 {
294 QString s = QFileDialog::getExistingDirectory(parent, caption, startDir); 262 QString s = QFileDialog::getExistingDirectory(parent, caption, startDir);
295 return KURL(s); 263 return KUrl(s);
296 } 264 }
297 265
298 QString KFileDialog::getSaveFileName (const QString &startDir, 266 QString KFileDialog::getSaveFileName (const QString &startDir,
299 const QString &filter, 267 const QString &filter,
300 QWidget *parent, 268 QWidget *parent,
326 { 294 {
327 m_pMainWindow = parent; 295 m_pMainWindow = parent;
328 } 296 }
329 297
330 298
331 KMainWindow::KMainWindow( QWidget* parent, const char* name ) 299 KMainWindow::KMainWindow( QWidget* parent )
332 : QMainWindow( parent ), m_actionCollection(this) 300 : QMainWindow( parent ), m_actionCollection(this)
333 { 301 {
334 setObjectName(name);
335 fileMenu = menuBar()->addMenu( i18n("&File") ); 302 fileMenu = menuBar()->addMenu( i18n("&File") );
336 editMenu = menuBar()->addMenu(i18n("&Edit") ); 303 editMenu = menuBar()->addMenu(i18n("&Edit") );
337 directoryMenu = menuBar()->addMenu(i18n("&Directory") ); 304 directoryMenu = menuBar()->addMenu(i18n("&Directory") );
338 dirCurrentItemMenu = 0; 305 dirCurrentItemMenu = 0;
339 dirCurrentSyncItemMenu = 0; 306 dirCurrentSyncItemMenu = 0;
343 windowsMenu = menuBar()->addMenu(i18n("&Window") ); 310 windowsMenu = menuBar()->addMenu(i18n("&Window") );
344 settingsMenu = menuBar()->addMenu(i18n("&Settings") ); 311 settingsMenu = menuBar()->addMenu(i18n("&Settings") );
345 helpMenu = menuBar()->addMenu(i18n("&Help") ); 312 helpMenu = menuBar()->addMenu(i18n("&Help") );
346 313
347 m_pToolBar = new KToolBar(this); 314 m_pToolBar = new KToolBar(this);
315 addToolBar( m_pToolBar );
348 316
349 memberList = new QList<KMainWindow*>; 317 memberList = new QList<KMainWindow*>;
350 memberList->append(this); 318 memberList->append(this);
351 } 319 }
352 320
360 return &m_actionCollection; 328 return &m_actionCollection;
361 } 329 }
362 330
363 void KMainWindow::createGUI() 331 void KMainWindow::createGUI()
364 { 332 {
365 KStdAction::help(this, SLOT(slotHelp()), actionCollection()); 333 KStandardAction::help(this, SLOT(appHelpActivated()), actionCollection());
366 KStdAction::about(this, SLOT(slotAbout()), actionCollection()); 334 KStandardAction::about(this, SLOT(slotAbout()), actionCollection());
367 KStdAction::aboutQt(actionCollection()); 335 KStandardAction::aboutQt(actionCollection());
368 } 336 }
369 337
370 void KMainWindow::slotAbout() 338 void KMainWindow::slotAbout()
371 { 339 {
372 QDialog d; 340 QDialog d;
433 "\n\nLicence: GNU GPL Version 2" 401 "\n\nLicence: GNU GPL Version 2"
434 ); 402 );
435 */ 403 */
436 } 404 }
437 405
438 void KMainWindow::slotHelp() 406 void KMainWindow::appHelpActivated()
439 { 407 {
440 showHelp(); 408 showHelp();
441 } 409 }
442 410
443 411
449 return home + "/.kdiff3rc"; 417 return home + "/.kdiff3rc";
450 } 418 }
451 return QString(); 419 return QString();
452 } 420 }
453 421
454 KConfig::KConfig() 422 KConfigGroupData::~KConfigGroupData()
455 { 423 {
456 } 424 QFile f(m_fileName);
457 425 if ( f.open( QIODevice::WriteOnly | QIODevice::Text ) )
458 void KConfig::readConfigFile( const QString& configFileName ) 426 { // file opened successfully
427 QTextStream t( &f ); // use a text stream
428 save(t);
429 f.close();
430 }
431 }
432
433 KConfigGroup::KConfigGroup()
434 {
435 d = new KConfigGroupData;
436 }
437
438 void KConfigGroup::readConfigFile( const QString& configFileName )
459 { 439 {
460 if ( !configFileName.isEmpty() ) 440 if ( !configFileName.isEmpty() )
461 { 441 {
462 m_fileName = configFileName; 442 d->m_fileName = configFileName;
463 } 443 }
464 else 444 else
465 { 445 {
466 m_fileName = KStandardDirs().findResource("config","kdiff3rc"); 446 d->m_fileName = KStandardDirs().findResource("config","kdiff3rc");
467 } 447 }
468 448
469 QFile f( m_fileName ); 449 QFile f( d->m_fileName );
470 if ( f.open(QIODevice::ReadOnly) ) 450 if ( f.open(QIODevice::ReadOnly) )
471 { // file opened successfully 451 { // file opened successfully
472 QTextStream t( &f ); // use a text stream 452 QTextStream t( &f ); // use a text stream
473 load(t); 453 d->load(t);
474 f.close(); 454 f.close();
475 } 455 }
476 } 456 }
477 457
478 KConfig::~KConfig() 458 KConfigGroup::~KConfigGroup()
479 { 459 {
480 QFile f(m_fileName); 460 }
481 if ( f.open( QIODevice::WriteOnly | QIODevice::Text ) ) 461
482 { // file opened successfully 462 void KConfigGroup::setGroup(const QString&)
483 QTextStream t( &f ); // use a text stream 463 {
484 save(t); 464 }
485 f.close(); 465
486 } 466 KConfigGroup& KConfigGroup::group( const QString& )
487 } 467 {
488 468 KApplication* pKApp = static_cast<KApplication*>(QApplication::instance());
489 void KConfig::setGroup(const QString&) 469 return *pKApp->config();
490 { 470 }
491 } 471
492 472 static void initAction( QAction* pAction, QObject* receiver, const char* slot, KActionCollection* actionCollection,
493 void KAction::init(QObject* receiver, const char* slot, KActionCollection* actionCollection, 473 const QString& name, bool bToggle, bool bMenu)
494 const char* name, bool bToggle, bool bMenu)
495 { 474 {
496 QString n(name); 475 QString n(name);
497 KMainWindow* p = actionCollection->m_pMainWindow; 476 KMainWindow* p = actionCollection->m_pMainWindow;
498 if( slot!=0 ) 477 if( slot!=0 )
499 { 478 {
500 if (!bToggle) 479 if (!bToggle)
501 connect(this, SIGNAL(triggered()), receiver, slot); 480 QObject::connect(pAction, SIGNAL(triggered()), receiver, slot);
502 else 481 else
503 { 482 {
504 connect(this, SIGNAL(toggled(bool)), receiver, slot); 483 QObject::connect(pAction, SIGNAL(toggled(bool)), receiver, slot);
505 } 484 }
506 } 485 }
507 486
508 if (bMenu) 487 if (bMenu)
509 { 488 {
510 if( n[0]=='g') p->movementMenu->addAction( this ); 489 if( n[0]=='g') p->movementMenu->addAction( pAction );
511 else if( n.left(16)=="dir_current_sync") 490 else if( n.left(16)=="dir_current_sync")
512 { 491 {
513 if ( p->dirCurrentItemMenu==0 ) 492 if ( p->dirCurrentItemMenu==0 )
514 { 493 {
515 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") ); 494 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") );
516 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") ); 495 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") );
517 } 496 }
518 p->dirCurrentItemMenu->addAction( this ); 497 p->dirCurrentItemMenu->addAction( pAction );
519 } 498 }
520 else if( n.left(11)=="dir_current") 499 else if( n.left(11)=="dir_current")
521 { 500 {
522 if ( p->dirCurrentItemMenu==0 ) 501 if ( p->dirCurrentItemMenu==0 )
523 { 502 {
524 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") ); 503 p->dirCurrentItemMenu = p->directoryMenu->addMenu( i18n("Current Item Merge Operation") );
525 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") ); 504 p->dirCurrentSyncItemMenu = p->directoryMenu->addMenu( i18n("Current Item Sync Operation") );
526 } 505 }
527 p->dirCurrentSyncItemMenu->addAction( this ); 506 p->dirCurrentSyncItemMenu->addAction( pAction );
528 } 507 }
529 else if( n.left(4)=="diff") p->diffMenu->addAction( this ); 508 else if( n.left(4)=="diff") p->diffMenu->addAction( pAction );
530 else if( name[0]=='d') p->directoryMenu->addAction( this ); 509 else if( name[0]=='d') p->directoryMenu->addAction( pAction );
531 else if( name[0]=='f') p->fileMenu->addAction( this ); 510 else if( name[0]=='f') p->fileMenu->addAction( pAction );
532 else if( name[0]=='w') p->windowsMenu->addAction( this ); 511 else if( name[0]=='w') p->windowsMenu->addAction( pAction );
533 else p->mergeMenu->addAction( this ); 512 else p->mergeMenu->addAction( pAction );
534 } 513 }
535 } 514 }
536 515
516 KAction::KAction(const QString& name, KActionCollection* actionCollection )
517 : QAction ( actionCollection->m_pMainWindow )
518 {
519 initAction( this, 0,0, actionCollection, name, false, true );
520 }
521
522 KAction::KAction( KActionCollection* actionCollection )
523 : QAction ( actionCollection->m_pMainWindow )
524 {
525 }
537 526
538 KAction::KAction(const QString& text, const QIcon& icon, int accel, 527 KAction::KAction(const QString& text, const QIcon& icon, int accel,
539 QObject* receiver, const char* slot, KActionCollection* actionCollection, 528 QObject* receiver, const char* slot, KActionCollection* actionCollection,
540 const char* name, bool bToggle, bool bMenu 529 const char* name, bool bToggle, bool bMenu
541 ) 530 )
545 setShortcut( accel ); 534 setShortcut( accel );
546 setCheckable( bToggle ); 535 setCheckable( bToggle );
547 KMainWindow* p = actionCollection->m_pMainWindow; 536 KMainWindow* p = actionCollection->m_pMainWindow;
548 if ( !icon.isNull() && p ) p->m_pToolBar->addAction( this ); 537 if ( !icon.isNull() && p ) p->m_pToolBar->addAction( this );
549 538
550 init(receiver,slot,actionCollection,name,bToggle,bMenu); 539 initAction(this, receiver,slot,actionCollection,name,bToggle,bMenu);
551 } 540 }
552 541
553 KAction::KAction(const QString& text, int accel, 542 KAction::KAction(const QString& text, int accel,
554 QObject* receiver, const char* slot, KActionCollection* actionCollection, 543 QObject* receiver, const char* slot, KActionCollection* actionCollection,
555 const char* name, bool bToggle, bool bMenu 544 const char* name, bool bToggle, bool bMenu
557 : QAction ( text, actionCollection->m_pMainWindow ) 546 : QAction ( text, actionCollection->m_pMainWindow )
558 { 547 {
559 setObjectName(name); 548 setObjectName(name);
560 setShortcut( accel ); 549 setShortcut( accel );
561 setCheckable( bToggle ); 550 setCheckable( bToggle );
562 init(receiver,slot,actionCollection,name,bToggle,bMenu); 551 initAction(this,receiver,slot,actionCollection,name,bToggle,bMenu);
563 } 552 }
564 553
565 void KAction::setStatusText(const QString&) 554 void KAction::setStatusText(const QString&)
566 { 555 {
567 } 556 }
569 void KAction::plug(QMenu* menu) 558 void KAction::plug(QMenu* menu)
570 { 559 {
571 menu->addAction( this ); 560 menu->addAction( this );
572 } 561 }
573 562
574 563 void KAction::setIcon( const QIcon& icon )
575 KToggleAction::KToggleAction(const QString& text, const QIcon& icon, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const char* name, bool bMenu) 564 {
576 : KAction( text, icon, accel, receiver, slot, actionCollection, name, true, bMenu) 565 QAction::setIcon(icon);
577 { 566 if ( !icon.isNull() )
567 {
568 KMainWindow* pMW = static_cast<KMainWindow*>( parent() );
569 pMW->toolBar()->addAction(this);
570 }
571 }
572
573
574 KToggleAction::KToggleAction( KActionCollection* actionCollection )
575 : KAction( actionCollection )
576 {
577 setCheckable(true);
578 } 578 }
579 579
580 KToggleAction::KToggleAction(const QString& text, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const char* name, bool bMenu) 580 KToggleAction::KToggleAction(const QString& text, int accel, QObject* receiver, const char* slot, KActionCollection* actionCollection, const char* name, bool bMenu)
581 : KAction( text, accel, receiver, slot, actionCollection, name, true, bMenu) 581 : KAction( text, accel, receiver, slot, actionCollection, name, true, bMenu)
582 { 582 {
594 blockSignals( false ); 594 blockSignals( false );
595 } 595 }
596 596
597 597
598 //static 598 //static
599 KAction* KStdAction::open( QWidget* parent, const char* slot, KActionCollection* actionCollection) 599 KAction* KStandardAction::open( QWidget* parent, const char* slot, KActionCollection* actionCollection)
600 { 600 {
601 #include "../xpm/fileopen.xpm" 601 #include "../xpm/fileopen.xpm"
602 KMainWindow* p = actionCollection->m_pMainWindow; 602 KMainWindow* p = actionCollection->m_pMainWindow;
603 KAction* a = new KAction( i18n("Open"), QIcon(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false); 603 KAction* a = new KAction( i18n("Open"), QIcon(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false);
604 if(p){ p->fileMenu->addAction( a ); } 604 if(p){ p->fileMenu->addAction( a ); }
605 return a; 605 return a;
606 } 606 }
607 607
608 KAction* KStdAction::save( QWidget* parent, const char* slot, KActionCollection* actionCollection ) 608 KAction* KStandardAction::save( QWidget* parent, const char* slot, KActionCollection* actionCollection )
609 { 609 {
610 #include "../xpm/filesave.xpm" 610 #include "../xpm/filesave.xpm"
611 KMainWindow* p = actionCollection->m_pMainWindow; 611 KMainWindow* p = actionCollection->m_pMainWindow;
612 KAction* a = new KAction( i18n("Save"), QIcon(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false); 612 KAction* a = new KAction( i18n("Save"), QIcon(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false);
613 if(p){ p->fileMenu->addAction( a ); } 613 if(p){ p->fileMenu->addAction( a ); }
614 return a; 614 return a;
615 } 615 }
616 616
617 KAction* KStdAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection) 617 KAction* KStandardAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection)
618 { 618 {
619 KMainWindow* p = actionCollection->m_pMainWindow; 619 KMainWindow* p = actionCollection->m_pMainWindow;
620 KAction* a = new KAction( i18n("Save As..."), 0, parent, slot, actionCollection, "saveas", false, false); 620 KAction* a = new KAction( i18n("Save As..."), 0, parent, slot, actionCollection, "saveas", false, false);
621 if(p) p->fileMenu->addAction( a ); 621 if(p) p->fileMenu->addAction( a );
622 return a; 622 return a;
623 } 623 }
624 624
625 KAction* KStdAction::print( QWidget* parent, const char* slot, KActionCollection* actionCollection) 625 KAction* KStandardAction::print( QWidget* parent, const char* slot, KActionCollection* actionCollection)
626 { 626 {
627 #include "../xpm/fileprint.xpm" 627 #include "../xpm/fileprint.xpm"
628 KMainWindow* p = actionCollection->m_pMainWindow; 628 KMainWindow* p = actionCollection->m_pMainWindow;
629 KAction* a = new KAction( i18n("Print..."), QIcon(QPixmap(fileprint)),Qt::CTRL+Qt::Key_P, parent, slot, actionCollection, "print", false, false); 629 KAction* a = new KAction( i18n("Print..."), QIcon(QPixmap(fileprint)),Qt::CTRL+Qt::Key_P, parent, slot, actionCollection, "print", false, false);
630 if(p) p->fileMenu->addAction( a ); 630 if(p) p->fileMenu->addAction( a );
631 return a; 631 return a;
632 } 632 }
633 633
634 KAction* KStdAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection) 634 KAction* KStandardAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection)
635 { 635 {
636 KMainWindow* p = actionCollection->m_pMainWindow; 636 KMainWindow* p = actionCollection->m_pMainWindow;
637 KAction* a = new KAction( i18n("Quit"), Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false); 637 KAction* a = new KAction( i18n("Quit"), Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false);
638 if(p) p->fileMenu->addAction( a ); 638 if(p) p->fileMenu->addAction( a );
639 return a; 639 return a;
640 } 640 }
641 641
642 KAction* KStdAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection) 642 KAction* KStandardAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection)
643 { 643 {
644 KMainWindow* p = actionCollection->m_pMainWindow; 644 KMainWindow* p = actionCollection->m_pMainWindow;
645 KAction* a = new KAction( i18n("Cut"), Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false ); 645 KAction* a = new KAction( i18n("Cut"), Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false );
646 if(p) p->editMenu->addAction( a ); 646 if(p) p->editMenu->addAction( a );
647 return a; 647 return a;
648 } 648 }
649 649
650 KAction* KStdAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection) 650 KAction* KStandardAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection)
651 { 651 {
652 KMainWindow* p = actionCollection->m_pMainWindow; 652 KMainWindow* p = actionCollection->m_pMainWindow;
653 KAction* a = new KAction( i18n("Copy"), Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false ); 653 KAction* a = new KAction( i18n("Copy"), Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false );
654 if(p) p->editMenu->addAction( a ); 654 if(p) p->editMenu->addAction( a );
655 return a; 655 return a;
656 } 656 }
657 657
658 KAction* KStdAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection) 658 KAction* KStandardAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection)
659 { 659 {
660 KMainWindow* p = actionCollection->m_pMainWindow; 660 KMainWindow* p = actionCollection->m_pMainWindow;
661 KAction* a = new KAction( i18n("Paste"), Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false ); 661 KAction* a = new KAction( i18n("Paste"), Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false );
662 if(p) p->editMenu->addAction( a ); 662 if(p) p->editMenu->addAction( a );
663 return a; 663 return a;
664 } 664 }
665 665
666 KAction* KStdAction::selectAll( QWidget* parent, const char* slot, KActionCollection* actionCollection) 666 KAction* KStandardAction::selectAll( QWidget* parent, const char* slot, KActionCollection* actionCollection)
667 { 667 {
668 KMainWindow* p = actionCollection->m_pMainWindow; 668 KMainWindow* p = actionCollection->m_pMainWindow;
669 KAction* a = new KAction( i18n("Select All"), Qt::CTRL+Qt::Key_A, parent, slot, actionCollection, "selectall", false, false ); 669 KAction* a = new KAction( i18n("Select All"), Qt::CTRL+Qt::Key_A, parent, slot, actionCollection, "selectall", false, false );
670 if(p) p->editMenu->addAction( a ); 670 if(p) p->editMenu->addAction( a );
671 return a; 671 return a;
672 } 672 }
673 673
674 KToggleAction* KStdAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) 674 KToggleAction* KStandardAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
675 { 675 {
676 KMainWindow* p = actionCollection->m_pMainWindow; 676 KMainWindow* p = actionCollection->m_pMainWindow;
677 KToggleAction* a = new KToggleAction( i18n("Show Toolbar"), 0, parent, slot, actionCollection, "showtoolbar", false ); 677 KToggleAction* a = new KToggleAction( i18n("Show Toolbar"), 0, parent, slot, actionCollection, "showtoolbar", false );
678 if(p) p->settingsMenu->addAction( a ); 678 if(p) p->settingsMenu->addAction( a );
679 return a; 679 return a;
680 } 680 }
681 681
682 KToggleAction* KStdAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) 682 KToggleAction* KStandardAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
683 { 683 {
684 KMainWindow* p = actionCollection->m_pMainWindow; 684 KMainWindow* p = actionCollection->m_pMainWindow;
685 KToggleAction* a = new KToggleAction( i18n("Show &Statusbar"), 0, parent, slot, actionCollection, "showstatusbar", false ); 685 KToggleAction* a = new KToggleAction( i18n("Show &Statusbar"), 0, parent, slot, actionCollection, "showstatusbar", false );
686 if(p) p->settingsMenu->addAction( a ); 686 if(p) p->settingsMenu->addAction( a );
687 return a; 687 return a;
688 } 688 }
689 689
690 KAction* KStdAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection) 690 KAction* KStandardAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection)
691 { 691 {
692 KMainWindow* p = actionCollection->m_pMainWindow; 692 KMainWindow* p = actionCollection->m_pMainWindow;
693 KAction* a = new KAction( i18n("&Configure %1...").arg("KDiff3"), 0, parent, slot, actionCollection, "settings", false, false ); 693 KAction* a = new KAction( i18n("&Configure %1...",QString("KDiff3")), 0, parent, slot, actionCollection, "settings", false, false );
694 if(p) p->settingsMenu->addAction( a ); 694 if(p) p->settingsMenu->addAction( a );
695 return a; 695 return a;
696 } 696 }
697 KAction* KStdAction::keyBindings( QWidget*, const char*, KActionCollection*) 697 KAction* KStandardAction::keyBindings( QWidget*, const char*, KActionCollection*)
698 { 698 {
699 return 0; 699 return 0;
700 } 700 }
701 701
702 KAction* KStdAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection) 702 KAction* KStandardAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection)
703 { 703 {
704 KMainWindow* p = actionCollection->m_pMainWindow; 704 KMainWindow* p = actionCollection->m_pMainWindow;
705 KAction* a = new KAction( i18n("About")+" KDiff3", 0, parent, slot, actionCollection, "about_kdiff3", false, false ); 705 KAction* a = new KAction( i18n("About")+" KDiff3", 0, parent, slot, actionCollection, "about_kdiff3", false, false );
706 if(p) p->helpMenu->addAction( a ); 706 if(p) p->helpMenu->addAction( a );
707 return a; 707 return a;
708 } 708 }
709 709
710 KAction* KStdAction::aboutQt( KActionCollection* actionCollection ) 710 KAction* KStandardAction::aboutQt( KActionCollection* actionCollection )
711 { 711 {
712 KMainWindow* p = actionCollection->m_pMainWindow; 712 KMainWindow* p = actionCollection->m_pMainWindow;
713 KAction* a = new KAction( i18n("About")+" Qt", 0, qApp, SLOT(aboutQt()), actionCollection, "about_qt", false, false ); 713 KAction* a = new KAction( i18n("About")+" Qt", 0, qApp, SLOT(aboutQt()), actionCollection, "about_qt", false, false );
714 if(p) p->helpMenu->addAction( a ); 714 if(p) p->helpMenu->addAction( a );
715 return a; 715 return a;
716 } 716 }
717 717
718 KAction* KStdAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection) 718 KAction* KStandardAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection)
719 { 719 {
720 KMainWindow* p = actionCollection->m_pMainWindow; 720 KMainWindow* p = actionCollection->m_pMainWindow;
721 KAction* a = new KAction( i18n("Help"), Qt::Key_F1, parent, slot, actionCollection, "help", false, false ); 721 KAction* a = new KAction( i18n("Help"), Qt::Key_F1, parent, slot, actionCollection, "help-contents", false, false );
722 if(p) p->helpMenu->addAction( a ); 722 if(p) p->helpMenu->addAction( a );
723 return a; 723 return a;
724 } 724 }
725 KAction* KStdAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection) 725 KAction* KStandardAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection)
726 { 726 {
727 KMainWindow* p = actionCollection->m_pMainWindow; 727 KMainWindow* p = actionCollection->m_pMainWindow;
728 KAction* a = new KAction( i18n("Find"), Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "find", false, false ); 728 KAction* a = new KAction( i18n("Find"), Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "edit-find", false, false );
729 if(p) p->editMenu->addAction( a ); 729 if(p) p->editMenu->addAction( a );
730 return a; 730 return a;
731 } 731 }
732 732
733 KAction* KStdAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection) 733 KAction* KStandardAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection)
734 { 734 {
735 KMainWindow* p = actionCollection->m_pMainWindow; 735 KMainWindow* p = actionCollection->m_pMainWindow;
736 KAction* a = new KAction( i18n("Find Next"), Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false ); 736 KAction* a = new KAction( i18n("Find Next"), Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false );
737 if(p) p->editMenu->addAction( a ); 737 if(p) p->editMenu->addAction( a );
738 return a; 738 return a;
739 } 739 }
740 740
741 741 KAction* KActionCollection::addAction(const QString& name )
742 742 {
743 743 return new KAction( name, this );
744 KFontChooser::KFontChooser( QWidget* pParent, const QString& /*name*/, bool, const QStringList&, bool, int ) 744 }
745
746 void KActionCollection::addAction( const QString& name, QAction* pAction )
747 {
748 initAction( pAction, 0,0,this,name,false,true);
749 }
750
751 KFontChooser::KFontChooser( QWidget* pParent )
745 : QWidget(pParent) 752 : QWidget(pParent)
746 { 753 {
747 m_pParent = pParent; 754 m_pParent = pParent;
748 QVBoxLayout* pLayout = new QVBoxLayout( this ); 755 QVBoxLayout* pLayout = new QVBoxLayout( this );
749 m_pSelectFont = new QPushButton(i18n("Select Font"), this ); 756 m_pSelectFont = new QPushButton(i18n("Select Font"), this );
854 void KPrinter::setPageSelection(e_PageSelection) 861 void KPrinter::setPageSelection(e_PageSelection)
855 { 862 {
856 } 863 }
857 864
858 865
859 QPixmap KIconLoader::loadIcon( const QString&, int ) 866 QPixmap KIconLoader::loadIcon( const QString&, int, int )
860 { 867 {
861 return QPixmap(); 868 return QPixmap();
862 } 869 }
863 870
864 KAboutData::KAboutData( const QString& /*name*/, const QString& appName, const QString& version, 871 KAboutData::KAboutData(const QByteArray &appName, const QByteArray & /*catalogName*/, const KLocalizedString & /*programName*/,
865 const QString& description, int, 872 const QByteArray &version, const KLocalizedString &shortDescription, LicenseKey /*licenseType*/,
866 const QString& copyright, int, const QString& homepage, const QString& email) 873 const KLocalizedString &copyrightStatement, const KLocalizedString & /*text*/,
867 { 874 const QByteArray &homePageAddress, const QByteArray &bugsEmailAddress)
868 s_copyright = copyright; 875 {
869 s_email = email; 876 s_copyright = copyrightStatement;
877 s_email = bugsEmailAddress;
870 s_appName = appName; 878 s_appName = appName;
871 s_description = description; 879 s_description = shortDescription;
872 s_version = version; 880 s_version = version;
873 s_homepage = homepage; 881 s_homepage = homePageAddress;
874 } 882 }
875 883
876 KAboutData::KAboutData( const QString& /*name*/, const QString& /*appName*/, const QString& /*version*/ ) 884 KAboutData::KAboutData( const QString& /*name*/, const QString& /*appName*/, const QString& /*appName2*/, const QString& /*version*/ )
877 { 885 {
878 } 886 }
879 887
880 void KAboutData::addAuthor(const char* name, const char* task, const char* email, const char* weblink) 888 void KAboutData::addAuthor(const QString& name, const QString& task, const QString& email, const QString& weblink)
881 { 889 {
882 m_authorList.push_back( AboutDataEntry( name, task, email, weblink) ); 890 m_authorList.push_back( AboutDataEntry( name, task, email, weblink) );
883 } 891 }
884 892
885 void KAboutData::addCredit(const char* name, const char* task, const char* email, const char* weblink) 893 void KAboutData::addCredit(const QString& name, const QString& task, const QString& email, const QString& weblink)
886 { 894 {
887 m_creditList.push_back( AboutDataEntry( name, task, email, weblink) ); 895 m_creditList.push_back( AboutDataEntry( name, task, email, weblink) );
888 } 896 }
889 897
890 /* Option structure: e.g.: 898 /* Option structure: e.g.:
898 */ 906 */
899 //////////////// 907 ////////////////
900 static KCmdLineArgs s_cmdLineArgs; 908 static KCmdLineArgs s_cmdLineArgs;
901 static int s_argc; 909 static int s_argc;
902 static char** s_argv; 910 static char** s_argv;
903 static KCmdLineOptions* s_pOptions; 911
912 struct KCmdLineOptionsItem
913 {
914 QString name;
915 QString description;
916 int def;
917 };
918 static QList<KCmdLineOptionsItem> s_options;
904 919
905 static std::vector<QCStringList> s_vOption; 920 static std::vector<QCStringList> s_vOption;
906 static std::vector<const char*> s_vArg; 921 static std::vector<QString> s_vArg;
922
923 KCmdLineOptions& KCmdLineOptions::add( const QString& name, const QString& description )
924 {
925 KCmdLineOptionsItem i;
926 i.name = name;
927 i.description = description;
928 i.def = 0;
929 s_options.push_back(i);
930 return *this;
931 }
907 932
908 KCmdLineArgs* KCmdLineArgs::parsedArgs() // static 933 KCmdLineArgs* KCmdLineArgs::parsedArgs() // static
909 { 934 {
910 return &s_cmdLineArgs; 935 return &s_cmdLineArgs;
911 } 936 }
915 s_argc = argc; 940 s_argc = argc;
916 s_argv = argv; 941 s_argv = argv;
917 s_pAboutData = pAboutData; 942 s_pAboutData = pAboutData;
918 } 943 }
919 944
920 void KCmdLineArgs::addCmdLineOptions( KCmdLineOptions* options ) // static 945 void KCmdLineArgs::addCmdLineOptions( const KCmdLineOptions& /*options*/ ) // static
921 { 946 {
922 s_pOptions = options; 947 //s_pOptions = &options;
923 } 948 }
924 949
925 int KCmdLineArgs::count() 950 int KCmdLineArgs::count()
926 { 951 {
927 return s_vArg.size(); 952 return s_vArg.size();
928 } 953 }
929 954
930 QString KCmdLineArgs::arg(int idx) 955 QString KCmdLineArgs::arg(int idx)
931 { 956 {
932 return QString::fromLocal8Bit( s_vArg[idx] ); 957 return s_vArg[idx];
933 } 958 }
934 959
935 void KCmdLineArgs::clear() 960 void KCmdLineArgs::clear()
936 { 961 {
937 } 962 }
940 { 965 {
941 // Find the option 966 // Find the option
942 int j=0; 967 int j=0;
943 for( j=0; j<(int)s_vOption.size(); ++j ) 968 for( j=0; j<(int)s_vOption.size(); ++j )
944 { 969 {
945 const char* optName = s_pOptions[j].name; 970 QString optName = s_options[j].name;
946 const char* pos = strchr( optName,' ' ); 971 int pos = optName.indexOf( ' ' );
947 int len = pos==0 ? strlen( optName ) : pos - optName; 972 int len = pos==-1 ? optName.length() : pos;
948 973
949 if( s == QString::fromLatin1( optName, len ) ) 974 if( s == optName.left( len ) )
950 { 975 {
951 return s_vOption[j].isEmpty() ? QString() : s_vOption[j].last(); 976 return s_vOption[j].isEmpty() ? QString() : s_vOption[j].last();
952 } 977 }
953 } 978 }
954 assert(false); 979 assert(false);
955 return QString(); 980 return QString();
956 } 981 }
957 982
958 QCStringList KCmdLineArgs::getOptionList( const QString& s ) 983 QStringList KCmdLineArgs::getOptionList( const QString& s )
959 { 984 {
960 // Find the option 985 // Find the option
961 int j=0; 986 int j=0;
962 for( j=0; j<(int)s_vOption.size(); ++j ) 987 for( j=0; j<(int)s_vOption.size(); ++j )
963 { 988 {
964 const char* optName = s_pOptions[j].name; 989 QString optName = s_options[j].name;
965 const char* pos = strchr( optName,' ' ); 990 int pos = optName.indexOf( ' ' );
966 int len = pos==0 ? strlen( optName ) : pos - optName; 991 int len = pos==-1 ? optName.length() : pos;
967 992
968 if( s == QString::fromLatin1( optName, len) ) 993 if( s == optName.left( len ) )
969 { 994 {
970 return s_vOption[j]; 995 return s_vOption[j];
971 } 996 }
972 } 997 }
973 998
974 assert(false); 999 assert(false);
975 return QCStringList(); 1000 return QStringList();
976 } 1001 }
977 1002
978 bool KCmdLineArgs::isSet(const QString& s) 1003 bool KCmdLineArgs::isSet(const QString& s)
979 { 1004 {
980 // Find the option 1005 // Find the option
981 int j=0; 1006 int j=0;
982 for( j=0; j<(int)s_vOption.size(); ++j ) 1007 for( j=0; j<(int)s_vOption.size(); ++j )
983 { 1008 {
984 const char* optName = s_pOptions[j].name; 1009 QString optName = s_options[j].name;
985 if( s == QString( optName ) ) 1010 if( s == optName )
986 { 1011 {
987 return ! s_vOption[j].isEmpty(); 1012 return ! s_vOption[j].isEmpty();
988 } 1013 }
989 } 1014 }
990 assert(false); 1015 assert(false);
991 return false; 1016 return false;
992 } 1017 }
993 1018
1019
994 /////////////////// 1020 ///////////////////
995 KApplication* kapp; 1021 KApplication* kapp;
996 1022
997 KApplication::KApplication() 1023 KApplication::KApplication()
998 : QApplication( s_argc,s_argv ) 1024 : QApplication( s_argc,s_argv )
999 { 1025 {
1000 kapp = this; 1026 kapp = this;
1027
1028 //setStyle( new QWindowsStyle ); // doesn't show checkmarks on checkable icons in menu
1001 1029
1002 int nofOptions=0; 1030 int nofOptions=0;
1003 int nofArgs=0; 1031 int nofArgs=0;
1004 int i=0; 1032 int i=0;
1005 while( s_pOptions[i].name != 0 ) 1033 while( i < s_options.size() )
1006 { 1034 {
1007 if ( s_pOptions[i].name[0]=='[' ) 1035 if ( s_options[i].name[0]=='[' )
1008 nofArgs++; 1036 nofArgs++;
1009 else 1037 else
1010 nofOptions++; 1038 nofOptions++;
1011 1039
1012 ++i; 1040 ++i;
1022 configFileName = s_argv[i+1]; 1050 configFileName = s_argv[i+1];
1023 } 1051 }
1024 } 1052 }
1025 m_config.readConfigFile(configFileName); 1053 m_config.readConfigFile(configFileName);
1026 1054
1027 QStringList ignorableCmdLineOptionsList = m_config.readListEntry("IgnorableCmdLineOptions", QStringList("-u;-query;-html;-abort"), '|'); 1055 QStringList ignorableCmdLineOptionsList = m_config.readEntry("IgnorableCmdLineOptions", QStringList("-u;-query;-html;-abort"), '|');
1028 QString ignorableCmdLineOptions; 1056 QString ignorableCmdLineOptions;
1029 if ( !ignorableCmdLineOptionsList.isEmpty() ) 1057 if ( !ignorableCmdLineOptionsList.isEmpty() )
1030 ignorableCmdLineOptions = ignorableCmdLineOptionsList.front() + ";"; 1058 ignorableCmdLineOptions = ignorableCmdLineOptionsList.front() + ";";
1031 1059
1032 s_vOption.resize(nofOptions); 1060 s_vOption.resize(nofOptions);
1033 1061
1034 for( i=1; i<s_argc; ++i ) 1062 for( i=1; i<s_argc; ++i )
1035 { 1063 {
1036 if ( s_argv[i][0]=='-' ) // An option 1064 QString arg = s_argv[i];
1065 if ( arg[0]=='-' ) // An option
1037 { 1066 {
1038 if ( ignorableCmdLineOptions.contains(QString(s_argv[i])+";") ) 1067 if ( ignorableCmdLineOptions.contains( arg +";") )
1039 continue; 1068 continue;
1040 // Find the option 1069 // Find the option
1041 int j=0; 1070 int j=0;
1042 for( j=0; j<nofOptions; ++j ) 1071 for( j=0; j<nofOptions; ++j )
1043 { 1072 {
1044 const char* optName = s_pOptions[j].name; 1073 QString optName = s_options[j].name;
1045 const char* pos = strchr( optName,' ' ); 1074 int pos = optName.indexOf( ' ' );
1046 int len = pos==0 ? strlen( optName ) : pos - optName; 1075 int len = pos==-1 ? optName.length() : pos;
1047 int len2 = strlen(s_argv[i]); 1076 int len2 = arg.length();
1048 1077
1049 if( len>0 && ( s_argv[i][1]=='-' && len2-2==len && memcmp( &s_argv[i][2], optName, len )==0 || 1078 if( len>0 && ( arg[1]=='-' && len2-2==len && optName.left(len) == arg.mid(2,len) ||
1050 len2-1==len && memcmp( &s_argv[i][1], optName, len )==0 )) 1079 len2-1==len && optName.left(len) == arg.mid(1,len) ))
1051 { 1080 {
1052 if (s_pOptions[j].description == 0) // alias, because without description. 1081 if (s_options[j].description == 0) // alias, because without description.
1053 { 1082 {
1054 ++j; 1083 ++j;
1055 optName = s_pOptions[j].name; 1084 optName = s_options[j].name;
1056 pos = strchr( optName,' ' ); 1085 pos = optName.indexOf( ' ' );
1057 } 1086 }
1058 if (pos!=0){ ++i; s_vOption[j].append(s_argv[i]); } //use param 1087 if (pos!=-1){ ++i; s_vOption[j].append( s_argv[i] ); } //use param
1059 else { s_vOption[j].append("1"); } //set state 1088 else { s_vOption[j].append("1"); } //set state
1060 break; 1089 break;
1061 } 1090 }
1062 } 1091 }
1063 if (j==nofOptions) 1092 if (j==nofOptions)
1064 { 1093 {
1065 QString s; 1094 QString s;
1066 s = QString("Unknown option: ") + QString(s_argv[i]) + "\n"; 1095 s = QString("Unknown option: ") + arg + "\n";
1067 s += "If KDiff3 should ignore this option, run KDiff3 normally and edit\n" 1096 s += "If KDiff3 should ignore this option, run KDiff3 normally and edit\n"
1068 "the \"Command line options to ignore\" in the \"Integration Settings\".\n\n"; 1097 "the \"Command line options to ignore\" in the \"Integration Settings\".\n\n";
1069 1098
1070 s += "KDiff3-Usage when starting via commandline: \n"; 1099 s += "KDiff3-Usage when starting via commandline: \n";
1071 s += "- Comparing 2 files:\t\tkdiff3 file1 file2\n"; 1100 s += "- Comparing 2 files:\t\tkdiff3 file1 file2\n";
1082 1111
1083 j=0; 1112 j=0;
1084 int pos=s.length(); 1113 int pos=s.length();
1085 for( j=0; j<nofOptions; ++j ) 1114 for( j=0; j<nofOptions; ++j )
1086 { 1115 {
1087 if ( s_pOptions[j].description!=0 ) 1116 if ( s_options[j].description!=0 )
1088 { 1117 {
1089 if (s_pOptions[j].name[0]!='+') 1118 if (s_options[j].name[0]!='+')
1090 { 1119 {
1091 s += "-"; 1120 s += "-";
1092 if ( strlen(s_pOptions[j].name)>1 ) s += "-"; 1121 if ( s_options[j].name.length()>1 ) s += "-";
1093 } 1122 }
1094 s += s_pOptions[j].name; 1123 s += s_options[j].name;
1095 s += QString().fill(' ', minMaxLimiter( 20 - ((int)s.length()-pos), 3, 20 ) ); 1124 s += QString().fill(' ', minMaxLimiter( 20 - ((int)s.length()-pos), 3, 20 ) );
1096 s += s_pOptions[j].description; 1125 s += s_options[j].description;
1097 s +="\n"; 1126 s +="\n";
1098 pos=s.length(); 1127 pos=s.length();
1099 } 1128 }
1100 else 1129 else
1101 { 1130 {
1102 s += "-"; 1131 s += "-";
1103 if ( strlen(s_pOptions[j].name)>1 ) s += "-"; 1132 if ( s_options[j].name.length()>1 ) s += "-";
1104 s += s_pOptions[j].name; 1133 s += s_options[j].name;
1105 s += ", "; 1134 s += ", ";
1106 } 1135 }
1107 } 1136 }
1108 1137
1109 s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n"; 1138 s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n";
1117 1146
1118 ::exit(-1); 1147 ::exit(-1);
1119 } 1148 }
1120 } 1149 }
1121 else 1150 else
1122 s_vArg.push_back( s_argv[i] ); 1151 s_vArg.push_back( arg );
1123 } 1152 }
1124 } 1153 }
1125 1154
1126 KConfig* KApplication::config() 1155 KConfigGroup* KApplication::config()
1127 { 1156 {
1128 return &m_config; 1157 return &m_config;
1129 } 1158 }
1130 1159
1131 bool KApplication::isRestored() 1160 bool KApplication::isRestored()
1144 } 1173 }
1145 1174
1146 1175
1147 namespace KIO 1176 namespace KIO
1148 { 1177 {
1149 SimpleJob* mkdir( KURL ){return 0;} 1178 SimpleJob* mkdir( KUrl ){return 0;}
1150 SimpleJob* rmdir( KURL ){return 0;} 1179 SimpleJob* rmdir( KUrl ){return 0;}
1151 SimpleJob* file_delete( KURL, bool ){return 0;} 1180 SimpleJob* file_delete( KUrl, int ){return 0;}
1152 FileCopyJob* file_move( KURL, KURL, int, bool, bool, bool ) {return 0;} 1181 FileCopyJob* file_move( KUrl, KUrl, int, int ) {return 0;}
1153 FileCopyJob* file_copy( KURL, KURL, int, bool, bool, bool ) {return 0;} 1182 FileCopyJob* file_copy( KUrl, KUrl, int, int ) {return 0;}
1154 CopyJob* link( KURL, KURL, bool ) {return 0;} 1183 CopyJob* link( KUrl, KUrl, bool ) {return 0;}
1155 ListJob* listRecursive( KURL, bool, bool ){return 0;} 1184 ListJob* listRecursive( KUrl, bool, bool ){return 0;}
1156 ListJob* listDir( KURL, bool, bool ){return 0;} 1185 ListJob* listDir( KUrl, bool, bool ){return 0;}
1157 StatJob* stat( KURL, bool, int, bool ){return 0;} 1186 StatJob* stat( KUrl, bool, int, int ){return 0;}
1158 TransferJob* get( KURL, bool, bool ){return (TransferJob*)0;} 1187 TransferJob* get( KUrl, int ){return (TransferJob*)0;}
1159 TransferJob* put( KURL, int, bool, bool, bool ){return (TransferJob*)0;} 1188 TransferJob* put( KUrl, int, int ){return (TransferJob*)0;}
1160 }; 1189 };
1161 1190
1162 KActionCollection* KParts::Part::actionCollection() 1191 KActionCollection* KParts::Part::actionCollection()
1163 { 1192 {
1164 return 0; 1193 return 0;
1194 } 1223 }
1195 1224
1196 1225
1197 1226
1198 1227
1199 #include "kreplacements.moc" 1228 //#include "kreplacements.moc"