Commit 11dbd4d9 authored by Joachim Eibl's avatar Joachim Eibl

- OS2-port by Silvan Scherrer

- Fixed writing to KIO.
- Fix crash on A/B-overview (infinite recursion)


git-svn-id: https://kdiff3.svn.sourceforge.net/svnroot/kdiff3/trunk@99 c8aa9fed-2811-0410-8543-893ada326672
parent b17d053d
......@@ -462,7 +462,7 @@ void SourceData::readAndPreprocess( QTextCodec* pEncoding, bool bAutoDetectUnico
if ( faIn.exists() ) // fileInSize > 0 )
{
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
QString catCmd = "type";
fileNameIn1.replace( '/', "\\" );
#else
......
......@@ -69,7 +69,7 @@ public:
m_bMyUpdate = false;
m_bSelectionInProgress = false;
m_pTextCodec = 0;
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
m_eLineEndStyle = eLineEndStyleDos;
#else
m_eLineEndStyle = eLineEndStyleUnix;
......@@ -1089,7 +1089,7 @@ void DiffTextWindow::print( MyPainter& p, const QRect&, int firstLine, int nofLi
void DiffTextWindowData::draw( MyPainter& p, const QRect& invalidRect, int deviceWidth, int beginLine, int endLine )
{
m_lineNumberWidth = m_pOptionDialog->m_bShowLineNumbers ? (int)log10((double)m_size)+1 : 0;
m_lineNumberWidth = m_pOptionDialog->m_bShowLineNumbers ? (int)log10((double)qMax(m_size,1))+1 : 0;
if ( m_winIdx==1 )
{
......@@ -1310,7 +1310,7 @@ QString DiffTextWindow::getSelection()
!( d->m_bWordWrap && it+1<vectorSize && d3l == d->m_diff3WrapLineVector[it+1].pD3L )
)
{
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
selectionString += '\r';
#endif
selectionString += '\n';
......@@ -1754,7 +1754,7 @@ void DiffTextWindowFrame::setFirstLine( int firstLine )
if ( pDTW && pDTW->d->m_pDiff3LineVector )
{
QString s= i18n("Top line");
int lineNumberWidth = (int)log10((double)pDTW->d->m_size)+1;
int lineNumberWidth = (int)log10((double)qMax(pDTW->d->m_size,1))+1;
int l=pDTW->calcTopLineInFile(firstLine);
......
......@@ -2516,7 +2516,7 @@ bool DirectoryMergeWindow::copyFLD( const QString& srcName, const QString& destN
if ( fi.isSymLink() && ((fi.isDir() && !m_bFollowDirLinks) || (!fi.isDir() && !m_bFollowFileLinks)) )
{
m_pStatusInfo->addText(i18n("copyLink( %1 -> %2 )",srcName,destName));
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
// What are links?
#else
if ( m_bSimulatedMergeStarted )
......
......@@ -479,7 +479,7 @@ QString FileAccess::tempFileName()
#ifdef KREPLACEMENTS_H
QString fileName;
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
QString tmpDir = getenv("TEMP");
#else
QString tmpDir = "/tmp";
......@@ -535,7 +535,7 @@ bool FileAccess::removeDir( const QString& dirName )
return fh.rmDir( dirName );
}
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
bool FileAccess::symLink( const QString& /*linkTarget*/, const QString& /*linkLocation*/ )
{
return false;
......@@ -717,7 +717,7 @@ bool FileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOve
m_pFileAccess->m_statusText = QString();
connect( pJob, SIGNAL(result(KJob*)), this, SLOT(slotPutJobResult(KJob*)));
connect( pJob, SIGNAL(dataReq(KJob*, QByteArray&)), this, SLOT(slotPutData(KJob*, QByteArray&)));
connect( pJob, SIGNAL(dataReq(KIO::Job*, QByteArray&)), this, SLOT(slotPutData(KIO::Job*, QByteArray&)));
connect( pJob, SIGNAL(percent(KJob*,unsigned long)), this, SLOT(slotPercent(KJob*, unsigned long)));
g_pProgressDialog->enterEventLoop( pJob, i18n("Writing file: %1",m_pFileAccess->prettyAbsPath()) );
......@@ -727,7 +727,7 @@ bool FileAccessJobHandler::put(const void* pSrcBuffer, long maxLength, bool bOve
return true;
}
void FileAccessJobHandler::slotPutData( KJob* pJob, QByteArray& data )
void FileAccessJobHandler::slotPutData( KIO::Job* pJob, QByteArray& data )
{
if ( pJob->error() )
{
......@@ -1361,7 +1361,7 @@ bool FileAccessJobHandler::listDir( t_DirectoryList* pDirList, bool bRecursive,
{
cvsIgnoreList.init( *m_pFileAccess, cvsIgnoreExists(pDirList) );
}
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
bool bCaseSensitive = false;
#else
bool bCaseSensitive = true;
......
......@@ -163,7 +163,7 @@ private slots:
void slotPutJobResult( KJob* pJob );
void slotGetData(KJob*,const QByteArray&);
void slotPutData(KJob*, QByteArray&);
void slotPutData(KIO::Job*, QByteArray&);
void slotListDirInfoMessage( KJob*, const QString& msg );
void slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& l );
......
......@@ -52,7 +52,7 @@ namespace KDiff3 {
KToggleAction* theAction = new KToggleAction(ac);
ac->addAction( actionName, theAction );
theAction->setText( text );
QObject::connect( theAction, SIGNAL( toggled(bool) ), receiver, slot );
QObject::connect( theAction, SIGNAL( triggered(bool) ), receiver, slot );
return theAction;
}
......
......@@ -175,7 +175,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
}
if (!s.isEmpty())
{
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
// A windows program has no console
//KMessageBox::information(0, s,i18n("KDiff3-Usage"));
QDialog* pDialog = new QDialog(this);
......@@ -482,8 +482,10 @@ void KDiff3App::initActions( KActionCollection* ac )
fileSave->setStatusTip(i18n("Saves the merge result. All conflicts must be solved!"));
fileSaveAs = KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), ac);
fileSaveAs->setStatusTip(i18n("Saves the current document as..."));
#ifndef QT_NO_PRINTER
filePrint = KStandardAction::print(this, SLOT(slotFilePrint()), ac);
filePrint->setStatusTip(i18n("Print the differences"));
#endif
fileQuit = KStandardAction::quit(this, SLOT(slotFileQuit()), ac);
fileQuit->setStatusTip(i18n("Quits the application"));
editCut = KStandardAction::cut(this, SLOT(slotEditCut()), ac);
......@@ -585,7 +587,7 @@ void KDiff3App::initActions( KActionCollection* ac )
addManualDiffHelp = KDiff3::createAction< KAction >(i18n("Add Manual Diff Alignment"), KShortcut( Qt::CTRL+Qt::Key_Y ), this, SLOT(slotAddManualDiffHelp()), ac, "diff_add_manual_diff_help");
clearManualDiffHelpList = KDiff3::createAction< KAction >(i18n("Clear All Manual Diff Alignments"), KShortcut( Qt::CTRL+Qt::SHIFT+Qt::Key_Y ), this, SLOT(slotClearManualDiffHelpList()), ac, "diff_clear_manual_diff_help_list");
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
KDiff3::createAction< KAction >(i18n("Focus Next Window"), KShortcut(Qt::CTRL+Qt::Key_Tab), this, SLOT(slotWinFocusNext()), ac, "win_focus_next");
#endif
winFocusPrev = KDiff3::createAction< KAction >(i18n("Focus Prev Window"), KShortcut( Qt::ALT+Qt::Key_Left ), this, SLOT(slotWinFocusPrev()), ac, "win_focus_prev");
......@@ -775,7 +777,10 @@ void KDiff3App::slotFilePrint()
{
if ( !m_pDiffTextWindow1 )
return;
#ifdef QT_NO_PRINTER
slotStatusMsg( i18n( "Printing not implemented." ) );
#endif
#ifndef QT_NO_PRINTER
QPrinter printer;
QPrintDialog printDialog(&printer, this);
......@@ -980,6 +985,7 @@ void KDiff3App::slotFilePrint()
{
slotStatusMsg( i18n( "Printing aborted." ) );
}
#endif
}
void KDiff3App::slotFileQuit()
......
TEMPLATE = app
# When unresolved items remain during linking: Try adding "shared" in the CONFIG.
CONFIG += qt warn_on thread precompile_header
PRECOMPILED_HEADER = stable.h
!os2:PRECOMPILED_HEADER = stable.h
HEADERS = version.h \
diff.h \
difftextwindow.h \
......@@ -53,7 +53,9 @@ win32 {
QMAKE_LFLAGS += user32.lib shell32.lib
}
}
os2 {
RC_FILE = kdiff3os2.rc
}
unix {
documentation.path = /usr/local/share/doc/kdiff3
......
ICON 1 DISCARDABLE "kdiff3_os2.ico"
\ No newline at end of file
......@@ -62,13 +62,8 @@ static KAboutData* s_pAboutData;
static void showHelp()
{
#ifdef _WIN32
char buf[200];
int r= SearchPathA( 0, ".", 0, sizeof(buf), buf, 0 );
QString exePath;
if (r!=0) { exePath = buf; }
else { exePath = "."; }
#if defined(_WIN32) || defined(Q_OS_OS2)
QString exePath = QCoreApplication::applicationDirPath();
QFileInfo helpFile( exePath + "\\doc\\en\\index.html" );
if ( ! helpFile.exists() ) { helpFile.setFile( exePath + "\\..\\doc\\en\\index.html" ); }
......@@ -83,24 +78,27 @@ static void showHelp()
return;
}
#ifndef Q_OS_OS2
HINSTANCE hi = FindExecutableA( helpFile.fileName().toAscii(), helpFile.absolutePath().toAscii(), buf );
if ( int(hi)<=32 )
{
#endif
static QTextBrowser* pBrowser = 0;
if (pBrowser==0)
{
pBrowser = new QTextBrowser( 0 );
pBrowser->setMinimumSize( 600, 400 );
}
pBrowser->setSource(helpFile.filePath());
pBrowser->setSource(QUrl("file:///"+helpFile.filePath()));
pBrowser->show();
#ifndef Q_OS_OS2
}
else
{
QFileInfo prog( buf );
QProcess::startDetached ( prog.filePath(), QStringList( "file:///"+helpFile.absoluteFilePath() ) );
}
#endif
#else
static QTextBrowser* pBrowser = 0;
if (pBrowser==0)
......@@ -115,14 +113,9 @@ static void showHelp()
QString getTranslationDir(const QString& locale)
{
#ifdef _WIN32
wchar_t buf[200];
int r= SearchPathW( 0, L".", 0, sizeof(buf)/sizeof(wchar_t), buf, 0 );
buf[ sizeof(buf)/sizeof(wchar_t) -1 ] = 0;
#if defined(_WIN32) || defined(Q_OS_OS2)
QString exePath;
if (r!=0) { exePath = QString::fromUtf16( (ushort*)&buf[0] ); }
else { exePath = "."; }
exePath = QCoreApplication::applicationDirPath();
return exePath+"/translations";
#else
return (QString)"/usr/share/locale/" + locale + "/LC_MESSAGES";
......@@ -842,6 +835,7 @@ void KColorButton::slotClicked()
update();
}
#ifndef QT_NO_PRINTER
KPrinter::KPrinter()
{
}
......@@ -861,7 +855,7 @@ void KPrinter::setCurrentPage(int)
void KPrinter::setPageSelection(e_PageSelection)
{
}
#endif
QPixmap KIconLoader::loadIcon( const QString&, int, int )
{
......@@ -1136,7 +1130,7 @@ KApplication::KApplication()
}
s += "\n"+i18n("For more documentation, see the help-menu or the subdirectory doc.")+"\n";
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
// A windows program has no console
if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) )
continue;
......
......@@ -17,7 +17,9 @@
#ifndef KREPLACEMENTS_H
#define KREPLACEMENTS_H
#ifndef __OS2__
#pragma once
#endif
#include "common.h"
......@@ -385,6 +387,7 @@ public slots:
void slotClicked();
};
#ifndef QT_NO_PRINTER
class KPrinter : public QPrinter
{
public:
......@@ -394,6 +397,7 @@ public:
void setCurrentPage(int);
void setPageSelection(e_PageSelection);
};
#endif
class KStandardDirs
{
......
......@@ -150,6 +150,11 @@ int main(int argc, char *argv[])
}
#endif
#ifdef Q_OS_OS2
// expand wildcards on the command line
_wildcard(&argc, &argv);
#endif
//QApplication::setColorSpec( QApplication::ManyColor ); // Grab all 216 colors
const QByteArray& appName = QByteArray("kdiff3");
......
......@@ -27,7 +27,7 @@
#include <QRadioButton>
#include <QGroupBox>
#include <QTextCodec>
#include <QDir>
#include <QSettings>
#include <QLocale>
#include <QGridLayout>
......@@ -1119,7 +1119,7 @@ void OptionDialog::setupDirectoryMergePage( void )
OptionCheckBox* pFindHidden = new OptionCheckBox( i18n("Find hidden files and directories"), true, "FindHidden", &m_bDmFindHidden, page, this );
gbox->addWidget( pFindHidden, line, 0, 1, 2 );
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
pFindHidden->setToolTip( i18n("Finds files and directories with the hidden attribute.") );
#else
pFindHidden->setToolTip( i18n("Finds files and directories starting with '.'.") );
......@@ -1148,7 +1148,7 @@ void OptionDialog::setupDirectoryMergePage( void )
// "Files and directories without change will not appear in the list."));
//++line;
#ifdef _WIN32
#if defined(_WIN32) || defined(Q_OS_OS2)
bool bCaseSensitiveFilenameComparison = false;
#else
bool bCaseSensitiveFilenameComparison = true;
......@@ -1429,7 +1429,7 @@ static const char* countryMap[]={
pLanguage->addItem( "Auto" ); // Must not translate, won't work otherwise!
pLanguage->addItem( "en_orig" );
#ifndef _WIN32
#if !defined(_WIN32) && !defined(Q_OS_OS2)
// Read directory: Find all kdiff3_*.qm-files and insert the found files here
QDir localeDir( "/usr/share/locale" ); // See also kreplacements.cpp: getTranslationDir()
QStringList dirList = localeDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment