comparison kdiff3/src/kreplacements/kreplacements.cpp @ 53:32d5cbf9db71

Corrections for 0.9.81: - Fix for configure --enable-final - Bugfixes - First steps towards internationalisation
author joachim99
date Tue, 20 Jan 2004 20:19:59 +0000
parents c59d5a3a8ff3
children 8af4bb9d9a5a
comparison
equal deleted inserted replaced
52:ba22ec30aa4e 53:32d5cbf9db71
99 pBrowser->setSource("/usr/local/share/doc/kdiff3/en/index.html"); 99 pBrowser->setSource("/usr/local/share/doc/kdiff3/en/index.html");
100 pBrowser->show(); 100 pBrowser->show();
101 #endif 101 #endif
102 } 102 }
103 103
104 QString getTranslationDir()
105 {
106 #ifdef _WIN32
107 char buf[200];
108 int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 );
109
110 QString exePath;
111 if (r!=0) { exePath = buf; }
112 else { exePath = "."; }
113 return exePath;
114 #else
115 return ".";
116 #endif
117 }
104 118
105 // static 119 // static
106 void KMessageBox::error( QWidget* parent, const QString& text, const QString& caption ) 120 void KMessageBox::error( QWidget* parent, const QString& text, const QString& caption )
107 { 121 {
108 QMessageBox::critical( parent, caption, text ); 122 QMessageBox::critical( parent, caption, text );
132 146
133 int KMessageBox::warningYesNoCancel( QWidget* parent, const QString& text, const QString& caption, 147 int KMessageBox::warningYesNoCancel( QWidget* parent, const QString& text, const QString& caption,
134 const QString& button1, const QString& button2 ) 148 const QString& button1, const QString& button2 )
135 { 149 {
136 int val = QMessageBox::warning( parent, caption, text, 150 int val = QMessageBox::warning( parent, caption, text,
137 button1, button2, "Cancel" ); 151 button1, button2, i18n("Cancel") );
138 if ( val==0 ) return Yes; 152 if ( val==0 ) return Yes;
139 if ( val==1 ) return No; 153 if ( val==1 ) return No;
140 else return Cancel; 154 else return Cancel;
141 } 155 }
142 156
276 290
277 KMainWindow::KMainWindow( QWidget* parent, const QString& name ) 291 KMainWindow::KMainWindow( QWidget* parent, const QString& name )
278 : QMainWindow( parent, name ), m_actionCollection(this) 292 : QMainWindow( parent, name ), m_actionCollection(this)
279 { 293 {
280 fileMenu = new QPopupMenu(); 294 fileMenu = new QPopupMenu();
281 menuBar()->insertItem(tr("&File"), fileMenu); 295 menuBar()->insertItem(i18n("&File"), fileMenu);
282 editMenu = new QPopupMenu(); 296 editMenu = new QPopupMenu();
283 menuBar()->insertItem(tr("&Edit"), editMenu); 297 menuBar()->insertItem(i18n("&Edit"), editMenu);
284 directoryMenu = new QPopupMenu(); 298 directoryMenu = new QPopupMenu();
285 menuBar()->insertItem(tr("&Directory"), directoryMenu); 299 menuBar()->insertItem(i18n("&Directory"), directoryMenu);
286 dirCurrentItemMenu = 0; 300 dirCurrentItemMenu = 0;
287 dirCurrentSyncItemMenu = 0; 301 dirCurrentSyncItemMenu = 0;
288 movementMenu = new QPopupMenu(); 302 movementMenu = new QPopupMenu();
289 menuBar()->insertItem(tr("&Movement"), movementMenu); 303 menuBar()->insertItem(i18n("&Movement"), movementMenu);
290 mergeMenu = new QPopupMenu(); 304 mergeMenu = new QPopupMenu();
291 menuBar()->insertItem(tr("&Merge"), mergeMenu); 305 menuBar()->insertItem(i18n("&Merge"), mergeMenu);
292 windowsMenu = new QPopupMenu(); 306 windowsMenu = new QPopupMenu();
293 menuBar()->insertItem(tr("&Windows"), windowsMenu); 307 menuBar()->insertItem(i18n("&Window"), windowsMenu);
294 settingsMenu = new QPopupMenu(); 308 settingsMenu = new QPopupMenu();
295 menuBar()->insertItem(tr("&Settings"), settingsMenu); 309 menuBar()->insertItem(i18n("&Settings"), settingsMenu);
296 helpMenu = new QPopupMenu(); 310 helpMenu = new QPopupMenu();
297 menuBar()->insertItem(tr("&Help"), helpMenu); 311 menuBar()->insertItem(i18n("&Help"), helpMenu);
298 312
299 m_pToolBar = new KToolBar(this); 313 m_pToolBar = new KToolBar(this);
300 314
301 memberList = new QList<KMainWindow>; 315 memberList = new QList<KMainWindow>;
302 memberList->append(this); 316 memberList->append(this);
630 644
631 if (bMenu) 645 if (bMenu)
632 { 646 {
633 if( name[0]=='g') addTo( p->movementMenu ); 647 if( name[0]=='g') addTo( p->movementMenu );
634 else if( name.left(16)=="dir_current_sync") 648 else if( name.left(16)=="dir_current_sync")
635 { 649 {
636 if ( p->dirCurrentItemMenu==0 ) 650 if ( p->dirCurrentItemMenu==0 )
637 { 651 {
638 p->dirCurrentItemMenu = new QPopupMenu(); 652 p->dirCurrentItemMenu = new QPopupMenu();
639 p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); 653 p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu);
640 p->dirCurrentSyncItemMenu = new QPopupMenu(); 654 p->dirCurrentSyncItemMenu = new QPopupMenu();
641 p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); 655 p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu);
642 } 656 }
643 addTo( p->dirCurrentItemMenu ); 657 addTo( p->dirCurrentItemMenu );
644 } 658 }
645 else if( name.left(11)=="dir_current") 659 else if( name.left(11)=="dir_current")
646 { 660 {
647 if ( p->dirCurrentItemMenu==0 ) 661 if ( p->dirCurrentItemMenu==0 )
648 { 662 {
649 p->dirCurrentItemMenu = new QPopupMenu(); 663 p->dirCurrentItemMenu = new QPopupMenu();
650 p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); 664 p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu);
651 p->dirCurrentSyncItemMenu = new QPopupMenu(); 665 p->dirCurrentSyncItemMenu = new QPopupMenu();
652 p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); 666 p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu);
653 } 667 }
654 addTo( p->dirCurrentSyncItemMenu ); 668 addTo( p->dirCurrentSyncItemMenu );
655 } 669 }
656 else if( name[0]=='d') addTo( p->directoryMenu ); 670 else if( name[0]=='d') addTo( p->directoryMenu );
657 else if( name[0]=='f') addTo( p->fileMenu ); 671 else if( name[0]=='f') addTo( p->fileMenu );
658 else if( name[0]=='w') addTo( p->windowsMenu ); 672 else if( name[0]=='w') addTo( p->windowsMenu );
659 else addTo( p->mergeMenu ); 673 else addTo( p->mergeMenu );
660 } 674 }
678 } 692 }
679 if (bMenu) 693 if (bMenu)
680 { 694 {
681 if( name[0]=='g') addTo( p->movementMenu ); 695 if( name[0]=='g') addTo( p->movementMenu );
682 else if( name.left(16)=="dir_current_sync") 696 else if( name.left(16)=="dir_current_sync")
683 { 697 {
684 if ( p->dirCurrentItemMenu==0 ) 698 if ( p->dirCurrentItemMenu==0 )
685 { 699 {
686 p->dirCurrentItemMenu = new QPopupMenu(); 700 p->dirCurrentItemMenu = new QPopupMenu();
687 p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); 701 p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu);
688 p->dirCurrentSyncItemMenu = new QPopupMenu(); 702 p->dirCurrentSyncItemMenu = new QPopupMenu();
689 p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); 703 p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu);
690 } 704 }
691 addTo( p->dirCurrentItemMenu ); 705 addTo( p->dirCurrentItemMenu );
692 } 706 }
693 else if( name.left(11)=="dir_current") 707 else if( name.left(11)=="dir_current")
694 { 708 {
695 if ( p->dirCurrentItemMenu==0 ) 709 if ( p->dirCurrentItemMenu==0 )
696 { 710 {
697 p->dirCurrentItemMenu = new QPopupMenu(); 711 p->dirCurrentItemMenu = new QPopupMenu();
698 p->directoryMenu->insertItem(tr("Current &Item Merge Operation"), p->dirCurrentItemMenu); 712 p->directoryMenu->insertItem(i18n("Current Item Merge Operation"), p->dirCurrentItemMenu);
699 p->dirCurrentSyncItemMenu = new QPopupMenu(); 713 p->dirCurrentSyncItemMenu = new QPopupMenu();
700 p->directoryMenu->insertItem(tr("Current Item Sync Operation"), p->dirCurrentSyncItemMenu); 714 p->directoryMenu->insertItem(i18n("Current Item Sync Operation"), p->dirCurrentSyncItemMenu);
701 } 715 }
702 addTo( p->dirCurrentSyncItemMenu ); 716 addTo( p->dirCurrentSyncItemMenu );
703 } 717 }
704 else if( name[0]=='d') addTo( p->directoryMenu ); 718 else if( name[0]=='d') addTo( p->directoryMenu );
705 else if( name[0]=='f') addTo( p->fileMenu ); 719 else if( name[0]=='f') addTo( p->fileMenu );
706 else if( name[0]=='w') addTo( p->windowsMenu ); 720 else if( name[0]=='w') addTo( p->windowsMenu );
707 else addTo( p->mergeMenu ); 721 else addTo( p->mergeMenu );
708 } 722 }
750 //static 764 //static
751 KAction* KStdAction::open( QWidget* parent, const char* slot, KActionCollection* actionCollection) 765 KAction* KStdAction::open( QWidget* parent, const char* slot, KActionCollection* actionCollection)
752 { 766 {
753 #include "../xpm/fileopen.xpm" 767 #include "../xpm/fileopen.xpm"
754 KMainWindow* p = actionCollection->m_pMainWindow; 768 KMainWindow* p = actionCollection->m_pMainWindow;
755 KAction* a = new KAction( "Open", QIconSet(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false); 769 KAction* a = new KAction( i18n("Open"), QIconSet(QPixmap(fileopen)), Qt::CTRL+Qt::Key_O, parent, slot, actionCollection, "open", false, false);
756 if(p){ a->addTo( p->fileMenu ); } 770 if(p){ a->addTo( p->fileMenu ); }
757 return a; 771 return a;
758 } 772 }
759 773
760 KAction* KStdAction::save( QWidget* parent, const char* slot, KActionCollection* actionCollection ) 774 KAction* KStdAction::save( QWidget* parent, const char* slot, KActionCollection* actionCollection )
761 { 775 {
762 #include "../xpm/filesave.xpm" 776 #include "../xpm/filesave.xpm"
763 KMainWindow* p = actionCollection->m_pMainWindow; 777 KMainWindow* p = actionCollection->m_pMainWindow;
764 KAction* a = new KAction( "Save", QIconSet(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false); 778 KAction* a = new KAction( i18n("Save"), QIconSet(QPixmap(filesave)), Qt::CTRL+Qt::Key_S, parent, slot, actionCollection, "save", false, false);
765 if(p){ a->addTo( p->fileMenu ); } 779 if(p){ a->addTo( p->fileMenu ); }
766 return a; 780 return a;
767 } 781 }
768 782
769 KAction* KStdAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection) 783 KAction* KStdAction::saveAs( QWidget* parent, const char* slot, KActionCollection* actionCollection)
770 { 784 {
771 KMainWindow* p = actionCollection->m_pMainWindow; 785 KMainWindow* p = actionCollection->m_pMainWindow;
772 KAction* a = new KAction( "SaveAs", 0, parent, slot, actionCollection, "saveas", false, false); 786 KAction* a = new KAction( i18n("Save As..."), 0, parent, slot, actionCollection, "saveas", false, false);
773 if(p) a->addTo( p->fileMenu ); 787 if(p) a->addTo( p->fileMenu );
774 return a; 788 return a;
775 } 789 }
776 790
777 KAction* KStdAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection) 791 KAction* KStdAction::quit( QWidget* parent, const char* slot, KActionCollection* actionCollection)
778 { 792 {
779 KMainWindow* p = actionCollection->m_pMainWindow; 793 KMainWindow* p = actionCollection->m_pMainWindow;
780 KAction* a = new KAction( "Quit", Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false); 794 KAction* a = new KAction( i18n("Quit"), Qt::CTRL+Qt::Key_Q, parent, slot, actionCollection, "quit", false, false);
781 if(p) a->addTo( p->fileMenu ); 795 if(p) a->addTo( p->fileMenu );
782 return a; 796 return a;
783 } 797 }
784 798
785 KAction* KStdAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection) 799 KAction* KStdAction::cut( QWidget* parent, const char* slot, KActionCollection* actionCollection)
786 { 800 {
787 KMainWindow* p = actionCollection->m_pMainWindow; 801 KMainWindow* p = actionCollection->m_pMainWindow;
788 KAction* a = new KAction( "Cut", Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false ); 802 KAction* a = new KAction( i18n("Cut"), Qt::CTRL+Qt::Key_X, parent, slot, actionCollection, "cut", false, false );
789 if(p) a->addTo( p->editMenu ); 803 if(p) a->addTo( p->editMenu );
790 return a; 804 return a;
791 } 805 }
792 806
793 KAction* KStdAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection) 807 KAction* KStdAction::copy( QWidget* parent, const char* slot, KActionCollection* actionCollection)
794 { 808 {
795 KMainWindow* p = actionCollection->m_pMainWindow; 809 KMainWindow* p = actionCollection->m_pMainWindow;
796 KAction* a = new KAction( "Copy", Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false ); 810 KAction* a = new KAction( i18n("Copy"), Qt::CTRL+Qt::Key_C, parent, slot, actionCollection, "copy", false, false );
797 if(p) a->addTo( p->editMenu ); 811 if(p) a->addTo( p->editMenu );
798 return a; 812 return a;
799 } 813 }
800 814
801 KAction* KStdAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection) 815 KAction* KStdAction::paste( QWidget* parent, const char* slot, KActionCollection* actionCollection)
802 { 816 {
803 KMainWindow* p = actionCollection->m_pMainWindow; 817 KMainWindow* p = actionCollection->m_pMainWindow;
804 KAction* a = new KAction( "Paste", Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false ); 818 KAction* a = new KAction( i18n("Paste"), Qt::CTRL+Qt::Key_V, parent, slot, actionCollection, "paste", false, false );
805 if(p) a->addTo( p->editMenu ); 819 if(p) a->addTo( p->editMenu );
806 return a; 820 return a;
807 } 821 }
808 822
809 KToggleAction* KStdAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) 823 KToggleAction* KStdAction::showToolbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
810 { 824 {
811 KMainWindow* p = actionCollection->m_pMainWindow; 825 KMainWindow* p = actionCollection->m_pMainWindow;
812 KToggleAction* a = new KToggleAction( "ShowToolBar", 0, parent, slot, actionCollection, "showtoolbar", false ); 826 KToggleAction* a = new KToggleAction( i18n("Show Toolbar"), 0, parent, slot, actionCollection, "showtoolbar", false );
813 if(p) a->addTo( p->settingsMenu ); 827 if(p) a->addTo( p->settingsMenu );
814 return a; 828 return a;
815 } 829 }
816 830
817 KToggleAction* KStdAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection) 831 KToggleAction* KStdAction::showStatusbar( QWidget* parent, const char* slot, KActionCollection* actionCollection)
818 { 832 {
819 KMainWindow* p = actionCollection->m_pMainWindow; 833 KMainWindow* p = actionCollection->m_pMainWindow;
820 KToggleAction* a = new KToggleAction( "ShowStatusBar", 0, parent, slot, actionCollection, "showstatusbar", false ); 834 KToggleAction* a = new KToggleAction( i18n("Show &Statusbar"), 0, parent, slot, actionCollection, "showstatusbar", false );
821 if(p) a->addTo( p->settingsMenu ); 835 if(p) a->addTo( p->settingsMenu );
822 return a; 836 return a;
823 } 837 }
824 838
825 KAction* KStdAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection) 839 KAction* KStdAction::preferences( QWidget* parent, const char* slot, KActionCollection* actionCollection)
826 { 840 {
827 KMainWindow* p = actionCollection->m_pMainWindow; 841 KMainWindow* p = actionCollection->m_pMainWindow;
828 KAction* a = new KAction( "Settings ...", 0, parent, slot, actionCollection, "settings", false, false ); 842 KAction* a = new KAction( i18n("&Configure %1...").arg("KDiff3"), 0, parent, slot, actionCollection, "settings", false, false );
829 if(p) a->addTo( p->settingsMenu ); 843 if(p) a->addTo( p->settingsMenu );
830 return a; 844 return a;
831 } 845 }
832 KAction* KStdAction::keyBindings( QWidget*, const char*, KActionCollection*) 846 KAction* KStdAction::keyBindings( QWidget*, const char*, KActionCollection*)
833 { 847 {
835 } 849 }
836 850
837 KAction* KStdAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection) 851 KAction* KStdAction::about( QWidget* parent, const char* slot, KActionCollection* actionCollection)
838 { 852 {
839 KMainWindow* p = actionCollection->m_pMainWindow; 853 KMainWindow* p = actionCollection->m_pMainWindow;
840 KAction* a = new KAction( "About", 0, parent, slot, actionCollection, "about", false, false ); 854 KAction* a = new KAction( i18n("About"), 0, parent, slot, actionCollection, "about", false, false );
841 if(p) a->addTo( p->helpMenu ); 855 if(p) a->addTo( p->helpMenu );
842 return a; 856 return a;
843 } 857 }
844 858
845 KAction* KStdAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection) 859 KAction* KStdAction::help( QWidget* parent, const char* slot, KActionCollection* actionCollection)
846 { 860 {
847 KMainWindow* p = actionCollection->m_pMainWindow; 861 KMainWindow* p = actionCollection->m_pMainWindow;
848 KAction* a = new KAction( "Help", Qt::Key_F1, parent, slot, actionCollection, "help", false, false ); 862 KAction* a = new KAction( i18n("Help"), Qt::Key_F1, parent, slot, actionCollection, "help", false, false );
849 if(p) a->addTo( p->helpMenu ); 863 if(p) a->addTo( p->helpMenu );
850 return a; 864 return a;
851 } 865 }
852 KAction* KStdAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection) 866 KAction* KStdAction::find( QWidget* parent, const char* slot, KActionCollection* actionCollection)
853 { 867 {
854 KMainWindow* p = actionCollection->m_pMainWindow; 868 KMainWindow* p = actionCollection->m_pMainWindow;
855 KAction* a = new KAction( "Find", Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "find", false, false ); 869 KAction* a = new KAction( i18n("Find"), Qt::CTRL+Qt::Key_F, parent, slot, actionCollection, "find", false, false );
856 if(p) a->addTo( p->editMenu ); 870 if(p) a->addTo( p->editMenu );
857 return a; 871 return a;
858 } 872 }
859 873
860 KAction* KStdAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection) 874 KAction* KStdAction::findNext( QWidget* parent, const char* slot, KActionCollection* actionCollection)
861 { 875 {
862 KMainWindow* p = actionCollection->m_pMainWindow; 876 KMainWindow* p = actionCollection->m_pMainWindow;
863 KAction* a = new KAction( "Find Next", Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false ); 877 KAction* a = new KAction( i18n("Find Next"), Qt::Key_F3, parent, slot, actionCollection, "findNext", false, false );
864 if(p) a->addTo( p->editMenu ); 878 if(p) a->addTo( p->editMenu );
865 return a; 879 return a;
866 } 880 }
867 881
868 882
871 KFontChooser::KFontChooser( QWidget* pParent, const QString& /*name*/, bool, const QStringList&, bool, int ) 885 KFontChooser::KFontChooser( QWidget* pParent, const QString& /*name*/, bool, const QStringList&, bool, int )
872 : QWidget(pParent) 886 : QWidget(pParent)
873 { 887 {
874 m_pParent = pParent; 888 m_pParent = pParent;
875 QVBoxLayout* pLayout = new QVBoxLayout( this ); 889 QVBoxLayout* pLayout = new QVBoxLayout( this );
876 m_pSelectFont = new QPushButton("Select Font", this ); 890 m_pSelectFont = new QPushButton(i18n("Select Font"), this );
877 connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont())); 891 connect(m_pSelectFont, SIGNAL(clicked()), this, SLOT(slotSelectFont()));
878 pLayout->addWidget(m_pSelectFont); 892 pLayout->addWidget(m_pSelectFont);
879 893
880 m_pLabel = new QLabel( "", this ); 894 m_pLabel = new QLabel( "", this );
881 m_pLabel->setFont( m_font ); 895 m_pLabel->setFont( m_font );