Mercurial > hg > easyhg-kdiff3
comparison kdiff3/src-QT4/kreplacements/kreplacements.cpp @ 95:6f42f5bd218e
- OS2-port by Silvan Scherrer
- Fixed writing to KIO.
- Fix crash on A/B-overview (infinite recursion)
author | joachim99 |
---|---|
date | Sun, 28 Feb 2010 20:32:34 +0000 |
parents | 4e6ebbbae925 |
children | f0c42ddbbda4 |
comparison
equal
deleted
inserted
replaced
94:b2f22ae5f810 | 95:6f42f5bd218e |
---|---|
60 #include <windows.h> | 60 #include <windows.h> |
61 #endif | 61 #endif |
62 | 62 |
63 static void showHelp() | 63 static void showHelp() |
64 { | 64 { |
65 #ifdef _WIN32 | 65 #if defined(_WIN32) || defined(Q_OS_OS2) |
66 char buf[200]; | 66 QString exePath = QCoreApplication::applicationDirPath(); |
67 int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 ); | |
68 | |
69 QString exePath; | |
70 if (r!=0) { exePath = buf; } | |
71 else { exePath = "."; } | |
72 | 67 |
73 QFileInfo helpFile( exePath + "\\doc\\en\\index.html" ); | 68 QFileInfo helpFile( exePath + "\\doc\\en\\index.html" ); |
74 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\en\\index.html" ); } | 69 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\en\\index.html" ); } |
75 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\doc\\index.html" ); } | 70 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\doc\\index.html" ); } |
76 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\index.html" ); } | 71 if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\index.html" ); } |
81 "The documentation can also be found at the homepage:\n\n " | 76 "The documentation can also be found at the homepage:\n\n " |
82 " http://kdiff3.sourceforge.net/"); | 77 " http://kdiff3.sourceforge.net/"); |
83 return; | 78 return; |
84 } | 79 } |
85 | 80 |
81 #ifndef Q_OS_OS2 | |
86 HINSTANCE hi = FindExecutableA( helpFile.fileName().toAscii(), helpFile.absolutePath().toAscii(), buf ); | 82 HINSTANCE hi = FindExecutableA( helpFile.fileName().toAscii(), helpFile.absolutePath().toAscii(), buf ); |
87 if ( int(hi)<=32 ) | 83 if ( int(hi)<=32 ) |
88 { | 84 { |
85 #endif | |
89 static QTextBrowser* pBrowser = 0; | 86 static QTextBrowser* pBrowser = 0; |
90 if (pBrowser==0) | 87 if (pBrowser==0) |
91 { | 88 { |
92 pBrowser = new QTextBrowser( 0 ); | 89 pBrowser = new QTextBrowser( 0 ); |
93 pBrowser->setMinimumSize( 600, 400 ); | 90 pBrowser->setMinimumSize( 600, 400 ); |
94 } | 91 } |
95 pBrowser->setSource(helpFile.filePath()); | 92 pBrowser->setSource(QUrl("file:///"+helpFile.filePath())); |
96 pBrowser->show(); | 93 pBrowser->show(); |
94 #ifndef Q_OS_OS2 | |
97 } | 95 } |
98 else | 96 else |
99 { | 97 { |
100 QFileInfo prog( buf ); | 98 QFileInfo prog( buf ); |
101 QProcess::startDetached ( prog.filePath(), QStringList( "file:///"+helpFile.absoluteFilePath() ) ); | 99 QProcess::startDetached ( prog.filePath(), QStringList( "file:///"+helpFile.absoluteFilePath() ) ); |
102 } | 100 } |
103 | 101 #endif |
104 #else | 102 #else |
105 static QTextBrowser* pBrowser = 0; | 103 static QTextBrowser* pBrowser = 0; |
106 if (pBrowser==0) | 104 if (pBrowser==0) |
107 { | 105 { |
108 pBrowser = new QTextBrowser( 0 ); | 106 pBrowser = new QTextBrowser( 0 ); |
113 #endif | 111 #endif |
114 } | 112 } |
115 | 113 |
116 QString getTranslationDir(const QString& locale) | 114 QString getTranslationDir(const QString& locale) |
117 { | 115 { |
118 #ifdef _WIN32 | 116 #if defined(_WIN32) || defined(Q_OS_OS2) |
119 wchar_t buf[200]; | |
120 int r= SearchPathW( 0, L".", 0, sizeof(buf)/sizeof(wchar_t), buf, 0 ); | |
121 | |
122 buf[ sizeof(buf)/sizeof(wchar_t) -1 ] = 0; | |
123 QString exePath; | 117 QString exePath; |
124 if (r!=0) { exePath = QString::fromUtf16( (ushort*)&buf[0] ); } | 118 exePath = QCoreApplication::applicationDirPath(); |
125 else { exePath = "."; } | |
126 return exePath+"/translations"; | 119 return exePath+"/translations"; |
127 #else | 120 #else |
128 return (QString)"/usr/share/locale/" + locale + "/LC_MESSAGES"; | 121 return (QString)"/usr/share/locale/" + locale + "/LC_MESSAGES"; |
129 #endif | 122 #endif |
130 } | 123 } |
840 QColor c = QColorDialog::getColor ( m_color, this ); | 833 QColor c = QColorDialog::getColor ( m_color, this ); |
841 if ( c.isValid() ) m_color = c; | 834 if ( c.isValid() ) m_color = c; |
842 update(); | 835 update(); |
843 } | 836 } |
844 | 837 |
838 #ifndef QT_NO_PRINTER | |
845 KPrinter::KPrinter() | 839 KPrinter::KPrinter() |
846 { | 840 { |
847 } | 841 } |
848 QList<int> KPrinter::pageList() | 842 QList<int> KPrinter::pageList() |
849 { | 843 { |
859 { | 853 { |
860 } | 854 } |
861 void KPrinter::setPageSelection(e_PageSelection) | 855 void KPrinter::setPageSelection(e_PageSelection) |
862 { | 856 { |
863 } | 857 } |
864 | 858 #endif |
865 | 859 |
866 QPixmap KIconLoader::loadIcon( const QString&, int, int ) | 860 QPixmap KIconLoader::loadIcon( const QString&, int, int ) |
867 { | 861 { |
868 return QPixmap(); | 862 return QPixmap(); |
869 } | 863 } |
1134 s += ", "; | 1128 s += ", "; |
1135 } | 1129 } |
1136 } | 1130 } |
1137 | 1131 |
1138 s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n"; | 1132 s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n"; |
1139 #ifdef _WIN32 | 1133 #if defined(_WIN32) || defined(Q_OS_OS2) |
1140 // A windows program has no console | 1134 // A windows program has no console |
1141 if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) ) | 1135 if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) ) |
1142 continue; | 1136 continue; |
1143 #else | 1137 #else |
1144 std::cerr << s.toLatin1().constData() << std::endl; | 1138 std::cerr << s.toLatin1().constData() << std::endl; |