comparison kdiff3/src/kdiff3.cpp @ 51:c59d5a3a8ff3

0.9.80
author joachim99
date Tue, 09 Dec 2003 20:29:43 +0000
parents 07416314eb5e
children 8af4bb9d9a5a
comparison
equal deleted inserted replaced
50:8c9752066f09 51:c59d5a3a8ff3
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/
17
18 /***************************************************************************
19 * $Log$
20 * Revision 1.2 2003/10/11 12:45:25 joachim99
21 * Allow CTRL-Tab for Windows
22 *
23 * Revision 1.1 2003/10/06 18:38:48 joachim99
24 * KDiff3 version 0.9.70
25 ***************************************************************************/ 16 ***************************************************************************/
26 17
27 #include "diff.h" 18 #include "diff.h"
28 19
29 #include <iostream> 20 #include <iostream>
112 m_pMergeResultWindow = 0; 103 m_pMergeResultWindow = 0;
113 m_pMergeWindowFrame = 0; 104 m_pMergeWindowFrame = 0;
114 m_bOutputModified = false; 105 m_bOutputModified = false;
115 m_bTimerBlock = false; 106 m_bTimerBlock = false;
116 107
108 // Needed before any file operations via FileAccess happen.
109 g_pProgressDialog = new ProgressDialog(this);
110
117 // Option handling: Only when pParent==0 (no parent) 111 // Option handling: Only when pParent==0 (no parent)
118 KCmdLineArgs *args = isPart() ? 0 : KCmdLineArgs::parsedArgs(); 112 KCmdLineArgs *args = isPart() ? 0 : KCmdLineArgs::parsedArgs();
119 113
120 if (args!=0) 114 if (args!=0)
121 { 115 {
145 if ( args!=0 ) 139 if ( args!=0 )
146 { 140 {
147 m_sd1.setFilename( args->getOption("base") ); 141 m_sd1.setFilename( args->getOption("base") );
148 if ( m_sd1.isEmpty() ) 142 if ( m_sd1.isEmpty() )
149 { 143 {
150 if ( args->count() > 0 ) m_sd1.setFilename( args->arg(0) ); 144 if ( args->count() > 0 ) m_sd1.setFilename( args->url(0).url() ); // args->arg(0)
151 if ( args->count() > 1 ) m_sd2.setFilename( args->arg(1) ); 145 if ( args->count() > 1 ) m_sd2.setFilename( args->url(1).url() );
152 if ( args->count() > 2 ) m_sd3.setFilename( args->arg(2) ); 146 if ( args->count() > 2 ) m_sd3.setFilename( args->url(2).url() );
153 } 147 }
154 else 148 else
155 { 149 {
156 if ( args->count() > 0 ) m_sd2.setFilename( args->arg(0) ); 150 if ( args->count() > 0 ) m_sd2.setFilename( args->url(0).url() );
157 if ( args->count() > 1 ) m_sd3.setFilename( args->arg(1) ); 151 if ( args->count() > 1 ) m_sd3.setFilename( args->url(1).url() );
158 } 152 }
159 153
160 QCStringList aliasList = args->getOptionList("fname"); 154 QCStringList aliasList = args->getOptionList("fname");
161 QCStringList::Iterator ali = aliasList.begin(); 155 QCStringList::Iterator ali = aliasList.begin();
162 if ( ali != aliasList.end() ) { m_sd1.setAliasName(*ali); ++ali; } 156 if ( ali != aliasList.end() ) { m_sd1.setAliasName(*ali); ++ali; }
163 if ( ali != aliasList.end() ) { m_sd2.setAliasName(*ali); ++ali; } 157 if ( ali != aliasList.end() ) { m_sd2.setAliasName(*ali); ++ali; }
164 if ( ali != aliasList.end() ) { m_sd3.setAliasName(*ali); ++ali; } 158 if ( ali != aliasList.end() ) { m_sd3.setAliasName(*ali); ++ali; }
165 } 159 }
166 g_pProgressDialog = new ProgressDialog(this);
167 /////////////////////////////////////////////////////////////////// 160 ///////////////////////////////////////////////////////////////////
168 // call inits to invoke all other construction parts 161 // call inits to invoke all other construction parts
169 initActions(actionCollection()); 162 initActions(actionCollection());
170 initStatusBar(); 163 initStatusBar();
171 164
175 // All default values must be set before calling readOptions(). 168 // All default values must be set before calling readOptions().
176 m_pOptionDialog = new OptionDialog( m_pKDiff3Shell!=0, this ); 169 m_pOptionDialog = new OptionDialog( m_pKDiff3Shell!=0, this );
177 connect( m_pOptionDialog, SIGNAL(applyClicked()), this, SLOT(slotRefresh()) ); 170 connect( m_pOptionDialog, SIGNAL(applyClicked()), this, SLOT(slotRefresh()) );
178 171
179 readOptions( isPart() ? m_pKDiff3Part->instance()->config() : kapp->config() ); 172 readOptions( isPart() ? m_pKDiff3Part->instance()->config() : kapp->config() );
173
174 autoAdvance->setChecked( m_pOptionDialog->m_bAutoAdvance );
175 showWhiteSpaceCharacters->setChecked( m_pOptionDialog->m_bShowWhiteSpaceCharacters );
176 showWhiteSpace->setChecked( m_pOptionDialog->m_bShowWhiteSpace );
177 showWhiteSpaceCharacters->setEnabled( m_pOptionDialog->m_bShowWhiteSpace );
178 showLineNumbers->setChecked( m_pOptionDialog->m_bShowLineNumbers );
180 179
181 m_pMainSplitter = this; //new QSplitter(this); 180 m_pMainSplitter = this; //new QSplitter(this);
182 m_pMainSplitter->setOrientation( Vertical ); 181 m_pMainSplitter->setOrientation( Vertical );
183 // setCentralWidget( m_pMainSplitter ); 182 // setCentralWidget( m_pMainSplitter );
184 m_pDirectoryMergeSplitter = new QSplitter( m_pMainSplitter ); 183 m_pDirectoryMergeSplitter = new QSplitter( m_pMainSplitter );
192 connect( m_pDirectoryMergeWindow, SIGNAL(selectionChanged()), this, SLOT(slotUpdateAvailabilities())); 191 connect( m_pDirectoryMergeWindow, SIGNAL(selectionChanged()), this, SLOT(slotUpdateAvailabilities()));
193 connect( m_pDirectoryMergeWindow, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(slotUpdateAvailabilities())); 192 connect( m_pDirectoryMergeWindow, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(slotUpdateAvailabilities()));
194 connect( m_pDirectoryMergeWindow, SIGNAL(checkIfCanContinue(bool*)), this, SLOT(slotCheckIfCanContinue(bool*))); 193 connect( m_pDirectoryMergeWindow, SIGNAL(checkIfCanContinue(bool*)), this, SLOT(slotCheckIfCanContinue(bool*)));
195 connect( m_pDirectoryMergeWindow, SIGNAL(updateAvailabilities()), this, SLOT(slotUpdateAvailabilities())); 194 connect( m_pDirectoryMergeWindow, SIGNAL(updateAvailabilities()), this, SLOT(slotUpdateAvailabilities()));
196 195
197 initDirectoryMergeActions(); 196 m_pDirectoryMergeWindow->initDirectoryMergeActions( this, actionCollection() );
198 197
199 if ( args!=0 ) args->clear(); // Free up some memory. 198 if ( args!=0 ) args->clear(); // Free up some memory.
200 199
201 if (m_pKDiff3Shell==0) 200 if (m_pKDiff3Shell==0)
202 { 201 {
292 if ( ! m_sd2.isEmpty() && m_sd2.m_pBuf==0 ) 291 if ( ! m_sd2.isEmpty() && m_sd2.m_pBuf==0 )
293 text += " - " + m_sd2.getAliasName() + "\n"; 292 text += " - " + m_sd2.getAliasName() + "\n";
294 if ( ! m_sd3.isEmpty() && m_sd3.m_pBuf==0 ) 293 if ( ! m_sd3.isEmpty() && m_sd3.m_pBuf==0 )
295 text += " - " + m_sd3.getAliasName() + "\n"; 294 text += " - " + m_sd3.getAliasName() + "\n";
296 295
297 KMessageBox::sorry( this, text, i18n("File open error") ); 296 KMessageBox::sorry( this, text, i18n("File Open Error") );
298 bFileOpenError = true; 297 bFileOpenError = true;
299 } 298 }
300 299
301 if ( m_sd1.isEmpty() || m_sd2.isEmpty() || bFileOpenError ) 300 if ( m_sd1.isEmpty() || m_sd2.isEmpty() || bFileOpenError )
302 slotFileOpen(); 301 slotFileOpen();
311 void KDiff3App::initActions( KActionCollection* ac ) 310 void KDiff3App::initActions( KActionCollection* ac )
312 { 311 {
313 if (ac==0) KMessageBox::error(0, "actionCollection==0"); 312 if (ac==0) KMessageBox::error(0, "actionCollection==0");
314 313
315 fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), ac); 314 fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), ac);
316 fileOpen->setStatusText(i18n("Opens documents for comparison ...")); 315 fileOpen->setStatusText(i18n("Opens documents for comparison..."));
317 fileSave = KStdAction::save(this, SLOT(slotFileSave()), ac); 316 fileSave = KStdAction::save(this, SLOT(slotFileSave()), ac);
318 fileSave->setStatusText(i18n("Saves the merge result. All conflicts must be solved!")); 317 fileSave->setStatusText(i18n("Saves the merge result. All conflicts must be solved!"));
319 fileSaveAs = KStdAction::saveAs(this, SLOT(slotFileSaveAs()), ac); 318 fileSaveAs = KStdAction::saveAs(this, SLOT(slotFileSaveAs()), ac);
320 fileSaveAs->setStatusText(i18n("Saves the current document as...")); 319 fileSaveAs->setStatusText(i18n("Saves the current document as..."));
321 fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), ac); 320 fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), ac);
335 viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()), ac); 334 viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()), ac);
336 viewStatusBar->setStatusText(i18n("Enables/disables the statusbar")); 335 viewStatusBar->setStatusText(i18n("Enables/disables the statusbar"));
337 KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), ac); 336 KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), ac);
338 KAction* pAction = KStdAction::preferences(this, SLOT(slotConfigure()), ac ); 337 KAction* pAction = KStdAction::preferences(this, SLOT(slotConfigure()), ac );
339 if ( isPart() ) 338 if ( isPart() )
340 pAction->setText("Configure KDiff3 ..."); 339 pAction->setText(i18n("Configure KDiff3..."));
341 340
342 341
343 #include "xpm/downend.xpm" 342 #include "xpm/downend.xpm"
344 #include "xpm/currentpos.xpm" 343 #include "xpm/currentpos.xpm"
345 #include "xpm/down1arrow.xpm" 344 #include "xpm/down1arrow.xpm"
358 //#include "reload.xpm" 357 //#include "reload.xpm"
359 358
360 goCurrent = new KAction(i18n("Go to Current Delta"), QIconSet(QPixmap(currentpos)), CTRL+Key_Space, this, SLOT(slotGoCurrent()), ac, "go_current"); 359 goCurrent = new KAction(i18n("Go to Current Delta"), QIconSet(QPixmap(currentpos)), CTRL+Key_Space, this, SLOT(slotGoCurrent()), ac, "go_current");
361 goTop = new KAction(i18n("Go to First Delta"), QIconSet(QPixmap(upend)), 0, this, SLOT(slotGoTop()), ac, "go_top"); 360 goTop = new KAction(i18n("Go to First Delta"), QIconSet(QPixmap(upend)), 0, this, SLOT(slotGoTop()), ac, "go_top");
362 goBottom = new KAction(i18n("Go to Last Delta"), QIconSet(QPixmap(downend)), 0, this, SLOT(slotGoBottom()), ac, "go_bottom"); 361 goBottom = new KAction(i18n("Go to Last Delta"), QIconSet(QPixmap(downend)), 0, this, SLOT(slotGoBottom()), ac, "go_bottom");
363 goPrevDelta = new KAction(i18n("Go to PrevDelta"), QIconSet(QPixmap(up1arrow)), CTRL+Key_Up, this, SLOT(slotGoPrevDelta()), ac, "go_prev_delta"); 362 goPrevDelta = new KAction(i18n("Go to Previous Delta"), QIconSet(QPixmap(up1arrow)), CTRL+Key_Up, this, SLOT(slotGoPrevDelta()), ac, "go_prev_delta");
364 goNextDelta = new KAction(i18n("Go to NextDelta"), QIconSet(QPixmap(down1arrow)), CTRL+Key_Down, this, SLOT(slotGoNextDelta()), ac, "go_next_delta"); 363 goNextDelta = new KAction(i18n("Go to Next Delta"), QIconSet(QPixmap(down1arrow)), CTRL+Key_Down, this, SLOT(slotGoNextDelta()), ac, "go_next_delta");
365 goPrevConflict = new KAction(i18n("Go to Previous Conflict"), QIconSet(QPixmap(up2arrow)), CTRL+Key_PageUp, this, SLOT(slotGoPrevConflict()), ac, "go_prev_conflict"); 364 goPrevConflict = new KAction(i18n("Go to Previous Conflict"), QIconSet(QPixmap(up2arrow)), CTRL+Key_PageUp, this, SLOT(slotGoPrevConflict()), ac, "go_prev_conflict");
366 goNextConflict = new KAction(i18n("Go to Next Conflict"), QIconSet(QPixmap(down2arrow)), CTRL+Key_PageDown, this, SLOT(slotGoNextConflict()), ac, "go_next_conflict"); 365 goNextConflict = new KAction(i18n("Go to Next Conflict"), QIconSet(QPixmap(down2arrow)), CTRL+Key_PageDown, this, SLOT(slotGoNextConflict()), ac, "go_next_conflict");
367 goPrevUnsolvedConflict = new KAction(i18n("Go to Previous Unsolved Conflict"), QIconSet(QPixmap(prevunsolved)), 0, this, SLOT(slotGoPrevUnsolvedConflict()), ac, "go_prev_unsolved_conflict"); 366 goPrevUnsolvedConflict = new KAction(i18n("Go to Previous Unsolved Conflict"), QIconSet(QPixmap(prevunsolved)), 0, this, SLOT(slotGoPrevUnsolvedConflict()), ac, "go_prev_unsolved_conflict");
368 goNextUnsolvedConflict = new KAction(i18n("Go to Next Unsolved Conflict"), QIconSet(QPixmap(nextunsolved)), 0, this, SLOT(slotGoNextUnsolvedConflict()), ac, "go_next_unsolved_conflict"); 367 goNextUnsolvedConflict = new KAction(i18n("Go to Next Unsolved Conflict"), QIconSet(QPixmap(nextunsolved)), 0, this, SLOT(slotGoNextUnsolvedConflict()), ac, "go_next_unsolved_conflict");
369 chooseA = new KToggleAction(i18n("Select line(s) from A"), QIconSet(QPixmap(iconA)), CTRL+Key_1, this, SLOT(slotChooseA()), ac, "merge_choose_a"); 368 chooseA = new KToggleAction(i18n("Select Line(s) From A"), QIconSet(QPixmap(iconA)), CTRL+Key_1, this, SLOT(slotChooseA()), ac, "merge_choose_a");
370 chooseB = new KToggleAction(i18n("Select line(s) from B"), QIconSet(QPixmap(iconB)), CTRL+Key_2, this, SLOT(slotChooseB()), ac, "merge_choose_b"); 369 chooseB = new KToggleAction(i18n("Select Line(s) From B"), QIconSet(QPixmap(iconB)), CTRL+Key_2, this, SLOT(slotChooseB()), ac, "merge_choose_b");
371 chooseC = new KToggleAction(i18n("Select line(s) from C"), QIconSet(QPixmap(iconC)), CTRL+Key_3, this, SLOT(slotChooseC()), ac, "merge_choose_c"); 370 chooseC = new KToggleAction(i18n("Select Line(s) From C"), QIconSet(QPixmap(iconC)), CTRL+Key_3, this, SLOT(slotChooseC()), ac, "merge_choose_c");
372 autoAdvance = new KToggleAction(i18n("Automatically go to next unsolved conflict after source selection"), QIconSet(QPixmap(autoadvance)), 0, this, SLOT(slotAutoAdvanceToggled()), ac, "merge_autoadvance"); 371 autoAdvance = new KToggleAction(i18n("Automatically Go to Next Unsolved Conflict After Source Selection"), QIconSet(QPixmap(autoadvance)), 0, this, SLOT(slotAutoAdvanceToggled()), ac, "merge_autoadvance");
373 showWhiteSpace = new KToggleAction(i18n("Show space and tabulator characters for differences"), QIconSet(QPixmap(showwhitespace)), 0, this, SLOT(slotShowWhiteSpaceToggled()), ac, "merge_showwhitespace"); 372
374 showLineNumbers = new KToggleAction(i18n("Show line numbers"), QIconSet(QPixmap(showlinenumbers)), 0, this, SLOT(slotShowLineNumbersToggled()), ac, "merge_showlinenumbers"); 373 showWhiteSpaceCharacters = new KToggleAction(i18n("Show Space && Tabulator Characters for Differences"), QIconSet(QPixmap(showwhitespace)), 0, this, SLOT(slotShowWhiteSpaceToggled()), ac, "merge_show_whitespace_characters");
374 showWhiteSpace = new KToggleAction(i18n("Show White Space"), 0, this, SLOT(slotShowWhiteSpaceToggled()), ac, "merge_show_whitespace");
375
376 showLineNumbers = new KToggleAction(i18n("Show Line Numbers"), QIconSet(QPixmap(showlinenumbers)), 0, this, SLOT(slotShowLineNumbersToggled()), ac, "merge_showlinenumbers");
375 chooseAEverywhere = new KAction(i18n("Choose A Everywhere"), CTRL+SHIFT+Key_1, this, SLOT(slotChooseAEverywhere()), ac, "merge_choose_a_everywhere"); 377 chooseAEverywhere = new KAction(i18n("Choose A Everywhere"), CTRL+SHIFT+Key_1, this, SLOT(slotChooseAEverywhere()), ac, "merge_choose_a_everywhere");
376 chooseBEverywhere = new KAction(i18n("Choose B Everywhere"), CTRL+SHIFT+Key_2, this, SLOT(slotChooseBEverywhere()), ac, "merge_choose_b_everywhere"); 378 chooseBEverywhere = new KAction(i18n("Choose B Everywhere"), CTRL+SHIFT+Key_2, this, SLOT(slotChooseBEverywhere()), ac, "merge_choose_b_everywhere");
377 chooseCEverywhere = new KAction(i18n("Choose C Everywhere"), CTRL+SHIFT+Key_3, this, SLOT(slotChooseCEverywhere()), ac, "merge_choose_c_everywhere"); 379 chooseCEverywhere = new KAction(i18n("Choose C Everywhere"), CTRL+SHIFT+Key_3, this, SLOT(slotChooseCEverywhere()), ac, "merge_choose_c_everywhere");
378 autoSolve = new KAction(i18n("Automatically solve simple conflicts"), 0, this, SLOT(slotAutoSolve()), ac, "merge_autosolve"); 380 chooseAForUnsolvedConflicts = new KAction(i18n("Choose A For All Unsolved Conflicts"), 0, this, SLOT(slotChooseAForUnsolvedConflicts()), ac, "merge_choose_a_for_unsolved_conflicts");
379 unsolve = new KAction(i18n("Set deltas to conflicts"), 0, this, SLOT(slotUnsolve()), actionCollection(), "merge_autounsolve"); 381 chooseBForUnsolvedConflicts = new KAction(i18n("Choose B For All Unsolved Conflicts"), 0, this, SLOT(slotChooseBForUnsolvedConflicts()), ac, "merge_choose_b_for_unsolved_conflicts");
380 fileReload = new KAction(i18n("Reload"), /*QIconSet(QPixmap(reloadIcon)),*/ 0, this, SLOT(slotReload()), ac, "file_reload"); 382 chooseCForUnsolvedConflicts = new KAction(i18n("Choose C For All Unsolved Conflicts"), 0, this, SLOT(slotChooseCForUnsolvedConflicts()), ac, "merge_choose_c_for_unsolved_conflicts");
383 chooseAForUnsolvedWhiteSpaceConflicts = new KAction(i18n("Choose A For All Unsolved Whitespace Conflicts"), 0, this, SLOT(slotChooseAForUnsolvedWhiteSpaceConflicts()), ac, "merge_choose_a_for_unsolved_whitespace_conflicts");
384 chooseBForUnsolvedWhiteSpaceConflicts = new KAction(i18n("Choose B For All Unsolved Whitespace Conflicts"), 0, this, SLOT(slotChooseBForUnsolvedWhiteSpaceConflicts()), ac, "merge_choose_b_for_unsolved_whitespace_conflicts");
385 chooseCForUnsolvedWhiteSpaceConflicts = new KAction(i18n("Choose C For All Unsolved Whitespace Conflicts"), 0, this, SLOT(slotChooseCForUnsolvedWhiteSpaceConflicts()), ac, "merge_choose_c_for_unsolved_whitespace_conflicts");
386 autoSolve = new KAction(i18n("Automatically Solve Simple Conflicts"), 0, this, SLOT(slotAutoSolve()), ac, "merge_autosolve");
387 unsolve = new KAction(i18n("Set Deltas to Conflicts"), 0, this, SLOT(slotUnsolve()), actionCollection(), "merge_autounsolve");
388 fileReload = new KAction(i18n("Reload"), /*QIconSet(QPixmap(reloadIcon)),*/ Key_F5, this, SLOT(slotReload()), ac, "file_reload");
381 showWindowA = new KToggleAction(i18n("Show Window A"), 0, this, SLOT(slotShowWindowAToggled()), ac, "win_show_a"); 389 showWindowA = new KToggleAction(i18n("Show Window A"), 0, this, SLOT(slotShowWindowAToggled()), ac, "win_show_a");
382 showWindowB = new KToggleAction(i18n("Show Window B"), 0, this, SLOT(slotShowWindowBToggled()), ac, "win_show_b"); 390 showWindowB = new KToggleAction(i18n("Show Window B"), 0, this, SLOT(slotShowWindowBToggled()), ac, "win_show_b");
383 showWindowC = new KToggleAction(i18n("Show Window C"), 0, this, SLOT(slotShowWindowCToggled()), ac, "win_show_c"); 391 showWindowC = new KToggleAction(i18n("Show Window C"), 0, this, SLOT(slotShowWindowCToggled()), ac, "win_show_c");
384 winFocusNext = new KAction(i18n("Focus Next Window"), ALT+Key_Right, this, SLOT(slotWinFocusNext()), ac, "win_focus_next"); 392 winFocusNext = new KAction(i18n("Focus Next Window"), ALT+Key_Right, this, SLOT(slotWinFocusNext()), ac, "win_focus_next");
385 #ifdef _WIN32 393 #ifdef _WIN32
386 new KAction(i18n("Focus Next Window"), CTRL+Key_Tab, this, SLOT(slotWinFocusNext()), ac, "win_focus_next", false, false); 394 new KAction(i18n("Focus Next Window"), CTRL+Key_Tab, this, SLOT(slotWinFocusNext()), ac, "win_focus_next", false, false);
387 #endif 395 #endif
388 winFocusPrev = new KAction(i18n("Focus Prev Window"), ALT+Key_Left, this, SLOT(slotWinFocusPrev()), ac, "win_focus_prev"); 396 winFocusPrev = new KAction(i18n("Focus Prev Window"), ALT+Key_Left, this, SLOT(slotWinFocusPrev()), ac, "win_focus_prev");
389 winToggleSplitOrientation = new KAction(i18n("Toggle Split Orientation"), 0, this, SLOT(slotWinToggleSplitterOrientation()), ac, "win_toggle_split_orientation"); 397 winToggleSplitOrientation = new KAction(i18n("Toggle Split Orientation"), 0, this, SLOT(slotWinToggleSplitterOrientation()), ac, "win_toggle_split_orientation");
390 } 398
391 399 dirShowBoth = new KToggleAction(i18n("Dir && Text Split Screen View"), 0, this, SLOT(slotDirShowBoth()), ac, "win_dir_show_both");
392 void KDiff3App::initDirectoryMergeActions()
393 {
394 #include "xpm/startmerge.xpm"
395 //dirOpen = new KAction(i18n("Open directories ..."), 0, this, SLOT(slotDirOpen()), actionCollection(), "dir_open");
396 dirStartOperation = new KAction(i18n("Start/Continue directory merge"), Key_F5, m_pDirectoryMergeWindow, SLOT(mergeContinue()), actionCollection(), "dir_start_operation");
397 dirCompareCurrent = new KAction(i18n("Compare selected file"), 0, m_pDirectoryMergeWindow, SLOT(compareCurrentFile()), actionCollection(), "dir_compare_current");
398 dirMergeCurrent = new KAction(i18n("Merge current file"), QIconSet(QPixmap(startmerge)), 0, this, SLOT(slotMergeCurrentFile()), actionCollection(), "merge_current");
399 dirShowBoth = new KToggleAction(i18n("Dir and Text Split Screen View"), 0, this, SLOT(slotDirShowBoth()), actionCollection(), "win_dir_show_both");
400 dirShowBoth->setChecked( true ); 400 dirShowBoth->setChecked( true );
401 dirViewToggle = new KAction(i18n("Toggle between Dir and Text View"), 0, this, SLOT(slotDirViewToggle()), actionCollection(), "win_dir_view_toggle"); 401 dirViewToggle = new KAction(i18n("Toggle Between Dir && Text View"), 0, this, SLOT(slotDirViewToggle()), actionCollection(), "win_dir_view_toggle");
402 dirFoldAll = new KAction(i18n("Fold all subdirs"), 0, m_pDirectoryMergeWindow, SLOT(slotFoldAllSubdirs()), actionCollection(), "dir_fold_all");
403 dirUnfoldAll = new KAction(i18n("Unfold all subdirs"), 0, m_pDirectoryMergeWindow, SLOT(slotUnfoldAllSubdirs()), actionCollection(), "dir_unfold_all");
404 dirRescan = new KAction(i18n("Rescan"), 0, m_pDirectoryMergeWindow, SLOT(reload()), actionCollection(), "dir_rescan");
405 dirChooseAEverywhere = new KAction(i18n("Choose A for all items"), 0, m_pDirectoryMergeWindow, SLOT(slotChooseAEverywhere()), actionCollection(), "dir_choose_a_everywhere");
406 dirChooseBEverywhere = new KAction(i18n("Choose B for all items"), 0, m_pDirectoryMergeWindow, SLOT(slotChooseBEverywhere()), actionCollection(), "dir_choose_b_everywhere");
407 dirChooseCEverywhere = new KAction(i18n("Choose C for all items"), 0, m_pDirectoryMergeWindow, SLOT(slotChooseCEverywhere()), actionCollection(), "dir_choose_c_everywhere");
408 dirAutoChoiceEverywhere = new KAction(i18n("Auto-choose operation for all items"), 0, m_pDirectoryMergeWindow, SLOT(slotAutoChooseEverywhere()), actionCollection(), "dir_autochoose_everywhere");
409 dirDoNothingEverywhere = new KAction(i18n("No operation for all items"), 0, m_pDirectoryMergeWindow, SLOT(slotNoOpEverywhere()), actionCollection(), "dir_nothing_everywhere");
410 // choose A/B/C/Suggestion/NoOp everywhere
411
412 402
413 m_pMergeEditorPopupMenu = new QPopupMenu( this ); 403 m_pMergeEditorPopupMenu = new QPopupMenu( this );
414 chooseA->plug( m_pMergeEditorPopupMenu ); 404 chooseA->plug( m_pMergeEditorPopupMenu );
415 chooseB->plug( m_pMergeEditorPopupMenu ); 405 chooseB->plug( m_pMergeEditorPopupMenu );
416 chooseC->plug( m_pMergeEditorPopupMenu ); 406 chooseC->plug( m_pMergeEditorPopupMenu );
417 } 407 }
408
418 409
419 void KDiff3App::showPopupMenu( const QPoint& point ) 410 void KDiff3App::showPopupMenu( const QPoint& point )
420 { 411 {
421 m_pMergeEditorPopupMenu->popup( point ); 412 m_pMergeEditorPopupMenu->popup( point );
422 } 413 }
439 config->writeEntry("Show Toolbar", viewToolBar->isChecked()); 430 config->writeEntry("Show Toolbar", viewToolBar->isChecked());
440 config->writeEntry("Show Statusbar",viewStatusBar->isChecked()); 431 config->writeEntry("Show Statusbar",viewStatusBar->isChecked());
441 if(toolBar("mainToolBar")!=0) 432 if(toolBar("mainToolBar")!=0)
442 config->writeEntry("ToolBarPos", (int) toolBar("mainToolBar")->barPos()); 433 config->writeEntry("ToolBarPos", (int) toolBar("mainToolBar")->barPos());
443 } 434 }
444 m_pOptionDialog->m_bAutoAdvance = autoAdvance->isChecked();
445 m_pOptionDialog->m_bShowWhiteSpace = showWhiteSpace->isChecked();
446 m_pOptionDialog->m_bShowLineNumbers = showLineNumbers->isChecked();
447
448 if ( m_pDiffWindowSplitter!=0 )
449 {
450 m_pOptionDialog->m_bHorizDiffWindowSplitting = m_pDiffWindowSplitter->orientation()==Horizontal;
451 }
452 435
453 m_pOptionDialog->saveOptions( config ); 436 m_pOptionDialog->saveOptions( config );
454 } 437 }
455 438
456 439
496 479
497 if(m_bOutputModified) 480 if(m_bOutputModified)
498 { 481 {
499 int result = KMessageBox::warningYesNoCancel(this, 482 int result = KMessageBox::warningYesNoCancel(this,
500 i18n("The merge result hasn't been saved."), 483 i18n("The merge result hasn't been saved."),
501 i18n("Warning"), i18n("Save and quit"), i18n("Quit without saving") ); 484 i18n("Warning"), i18n("Save && Quit"), i18n("Quit Without Saving") );
502 if ( result==KMessageBox::Cancel ) 485 if ( result==KMessageBox::Cancel )
503 return false; 486 return false;
504 else if ( result==KMessageBox::Yes ) 487 else if ( result==KMessageBox::Yes )
505 { 488 {
506 slotFileSave(); 489 slotFileSave();
516 499
517 if ( m_pDirectoryMergeWindow->isDirectoryMergeInProgress() ) 500 if ( m_pDirectoryMergeWindow->isDirectoryMergeInProgress() )
518 { 501 {
519 int result = KMessageBox::warningYesNo(this, 502 int result = KMessageBox::warningYesNo(this,
520 i18n("You are currently doing a directory merge. Are you sure, you want to abort?"), 503 i18n("You are currently doing a directory merge. Are you sure, you want to abort?"),
521 i18n("Warning"), i18n("Yes - Quit"), i18n("No - Continue merging") ); 504 i18n("Warning"), i18n("Quit"), i18n("Continue Merging") );
522 if ( result!=KMessageBox::Yes ) 505 if ( result!=KMessageBox::Yes )
523 return false; 506 return false;
524 } 507 }
525 508
526 return true; 509 return true;
556 539
557 void KDiff3App::slotFileSaveAs() 540 void KDiff3App::slotFileSaveAs()
558 { 541 {
559 slotStatusMsg(i18n("Saving file with a new filename...")); 542 slotStatusMsg(i18n("Saving file with a new filename..."));
560 543
561 QString s = KFileDialog::getSaveURL( QDir::currentDirPath(), 0, this, i18n("Save as...") ).url(); 544 QString s = KFileDialog::getSaveURL( QDir::currentDirPath(), 0, this, i18n("Save As...") ).url();
562 if(!s.isEmpty()) 545 if(!s.isEmpty())
563 { 546 {
564 m_outputFilename = s; 547 m_outputFilename = s;
565 bool bSuccess = m_pMergeResultWindow->saveDocument( m_outputFilename ); 548 bool bSuccess = m_pMergeResultWindow->saveDocument( m_outputFilename );
566 if ( bSuccess ) 549 if ( bSuccess )
657 640
658 m_pSearchString = new QLineEdit( this ); 641 m_pSearchString = new QLineEdit( this );
659 layout->addMultiCellWidget( m_pSearchString, line,line,0,1 ); 642 layout->addMultiCellWidget( m_pSearchString, line,line,0,1 );
660 ++line; 643 ++line;
661 644
662 m_pCaseSensitive = new QCheckBox(i18n("Case Sensitive"),this); 645 m_pCaseSensitive = new QCheckBox(i18n("Case sensitive"),this);
663 layout->addWidget( m_pCaseSensitive, line, 1 ); 646 layout->addWidget( m_pCaseSensitive, line, 1 );
664 647
665 m_pSearchInA = new QCheckBox(i18n("Search A"),this); 648 m_pSearchInA = new QCheckBox(i18n("Search A"),this);
666 layout->addWidget( m_pSearchInA, line, 0 ); 649 layout->addWidget( m_pSearchInA, line, 0 );
667 m_pSearchInA->setChecked( true ); 650 m_pSearchInA->setChecked( true );
675 m_pSearchInC = new QCheckBox(i18n("Search C"),this); 658 m_pSearchInC = new QCheckBox(i18n("Search C"),this);
676 layout->addWidget( m_pSearchInC, line, 0 ); 659 layout->addWidget( m_pSearchInC, line, 0 );
677 m_pSearchInC->setChecked( true ); 660 m_pSearchInC->setChecked( true );
678 ++line; 661 ++line;
679 662
680 m_pSearchInOutput = new QCheckBox(i18n("Search Output"),this); 663 m_pSearchInOutput = new QCheckBox(i18n("Search output"),this);
681 layout->addWidget( m_pSearchInOutput, line, 0 ); 664 layout->addWidget( m_pSearchInOutput, line, 0 );
682 m_pSearchInOutput->setChecked( true ); 665 m_pSearchInOutput->setChecked( true );
683 ++line; 666 ++line;
684 667
685 QPushButton* pButton = new QPushButton( i18n("Search"), this ); 668 QPushButton* pButton = new QPushButton( i18n("&Search"), this );
686 layout->addWidget( pButton, line, 0 ); 669 layout->addWidget( pButton, line, 0 );
687 connect( pButton, SIGNAL(clicked()), this, SLOT(accept())); 670 connect( pButton, SIGNAL(clicked()), this, SLOT(accept()));
688 671
689 pButton = new QPushButton( i18n("Cancel"), this ); 672 pButton = new QPushButton( i18n("&Cancel"), this );
690 layout->addWidget( pButton, line, 1 ); 673 layout->addWidget( pButton, line, 1 );
691 connect( pButton, SIGNAL(clicked()), this, SLOT(reject())); 674 connect( pButton, SIGNAL(clicked()), this, SLOT(reject()));
692 675
693 hide(); 676 hide();
694 } 677 }