diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kformula/main.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/main.cc')
-rw-r--r-- | lib/kformula/main.cc | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/lib/kformula/main.cc b/lib/kformula/main.cc index bbab2bbb..dde69731 100644 --- a/lib/kformula/main.cc +++ b/lib/kformula/main.cc @@ -2,17 +2,17 @@ #include <iostream> #include <memory> -#include <qaccel.h> -#include <qdom.h> -#include <qfile.h> -#include <qlayout.h> -#include <qptrlist.h> -#include <qmainwindow.h> -#include <qpainter.h> -#include <qstring.h> -#include <qtextstream.h> -#include <qwidget.h> -#include <qfileinfo.h> +#include <tqaccel.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqlayout.h> +#include <tqptrlist.h> +#include <tqmainwindow.h> +#include <tqpainter.h> +#include <tqstring.h> +#include <tqtextstream.h> +#include <tqwidget.h> +#include <tqfileinfo.h> #include <kapplication.h> #include <kaboutdata.h> @@ -33,44 +33,44 @@ using namespace KFormula; class TestWidget : public KFormulaWidget { public: - TestWidget(Container* doc, QWidget* parent=0, const char* name=0, WFlags f=0) - : KFormulaWidget(doc, parent, name, f) {} + TestWidget(Container* doc, TQWidget* tqparent=0, const char* name=0, WFlags f=0) + : KFormulaWidget(doc, tqparent, name, f) {} protected: - virtual void keyPressEvent(QKeyEvent* event); + virtual void keyPressEvent(TQKeyEvent* event); private: }; -void save( const QString &filename, const QDomDocument& doc ) +void save( const TQString &filename, const TQDomDocument& doc ) { - QFile f( filename ); + TQFile f( filename ); if(!f.open(IO_Truncate | IO_ReadWrite)) { kdWarning( DEBUGID ) << "Error opening file " << filename.latin1() << endl; return; } - QTextStream stream(&f); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&f); + stream.setEncoding(TQTextStream::UnicodeUTF8); doc.save(stream, 2); f.close(); } -void load( KFormula::Document* document, const QString &filename ) +void load( KFormula::Document* document, const TQString &filename ) { - QFile f(filename); + TQFile f(filename); if (!f.open(IO_ReadOnly)) { kdWarning( DEBUGID ) << "Error opening file " << filename.latin1() << endl; return; } - QTextStream stream(&f); - stream.setEncoding(QTextStream::UnicodeUTF8); - QString content = stream.read(); + TQTextStream stream(&f); + stream.setEncoding(TQTextStream::UnicodeUTF8); + TQString content = stream.read(); f.close(); //kdDebug( DEBUGID ) << content << endl; - QDomDocument doc; + TQDomDocument doc; if ( !doc.setContent( content ) ) { return; } @@ -80,34 +80,34 @@ void load( KFormula::Document* document, const QString &filename ) } -void saveMathML( KFormula::Container* formula, const QString &filename, bool oasisFormat ) +void saveMathML( KFormula::Container* formula, const TQString &filename, bool oasisFormat ) { - QFile f( filename ); + TQFile f( filename ); if ( !f.open( IO_Truncate | IO_ReadWrite ) ) { kdWarning( DEBUGID ) << "Error opening file " << filename.latin1() << endl; return; } - QTextStream stream( &f ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream stream( &f ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); formula->saveMathML( stream, oasisFormat ); f.close(); } -void loadMathML( KFormula::Container* formula, const QString &filename ) +void loadMathML( KFormula::Container* formula, const TQString &filename ) { - QFile f( filename ); + TQFile f( filename ); if ( !f.open( IO_ReadOnly ) ) { kdWarning( DEBUGID ) << "Error opening file " << filename.latin1() << endl; return; } - QTextStream stream( &f ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); - QString content = stream.read(); + TQTextStream stream( &f ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); + TQString content = stream.read(); - QDomDocument doc; - QString errorMsg; + TQDomDocument doc; + TQString errorMsg; int errorLine; int errorColumn; if ( !doc.setContent( content, true, @@ -129,7 +129,7 @@ void loadMathML( KFormula::Container* formula, const QString &filename ) } -void TestWidget::keyPressEvent(QKeyEvent* event) +void TestWidget::keyPressEvent(TQKeyEvent* event) { Container* document = getDocument(); @@ -137,19 +137,19 @@ void TestWidget::keyPressEvent(QKeyEvent* event) int state = event->state(); //MoveFlag flag = movementFlag(state); - if ( ( state & Qt::ShiftButton ) && ( state & Qt::ControlButton ) ) { + if ( ( state & TQt::ShiftButton ) && ( state & TQt::ControlButton ) ) { switch (event->key()) { - case Qt::Key_B: document->document()->wrapper()->appendColumn(); return; - case Qt::Key_I: document->document()->wrapper()->insertColumn(); return; - case Qt::Key_R: document->document()->wrapper()->removeColumn(); return; - case Qt::Key_Z: document->document()->wrapper()->redo(); return; - case Qt::Key_F: saveMathML( document, "test.mml", true/*save to oasis format*/ ); return; - case Qt::Key_M: saveMathML( document, "test.mml", false ); return; - case Qt::Key_O: { - QString file = KFileDialog::getOpenFileName(); + case TQt::Key_B: document->document()->wrapper()->appendColumn(); return; + case TQt::Key_I: document->document()->wrapper()->insertColumn(); return; + case TQt::Key_R: document->document()->wrapper()->removeColumn(); return; + case TQt::Key_Z: document->document()->wrapper()->redo(); return; + case TQt::Key_F: saveMathML( document, "test.mml", true/*save to oasis format*/ ); return; + case TQt::Key_M: saveMathML( document, "test.mml", false ); return; + case TQt::Key_O: { + TQString file = KFileDialog::getOpenFileName(); kdDebug( DEBUGID ) << file << endl; if( !file.isEmpty() ) { - QFileInfo fi( file ); + TQFileInfo fi( file ); if ( fi.extension() == "mml" ) { loadMathML( document, file ); } @@ -161,35 +161,35 @@ void TestWidget::keyPressEvent(QKeyEvent* event) } } } - else if (state & Qt::ControlButton) { + else if (state & TQt::ControlButton) { switch (event->key()) { - case Qt::Key_1: document->document()->wrapper()->addSum(); return; - case Qt::Key_2: document->document()->wrapper()->addProduct(); return; - case Qt::Key_3: document->document()->wrapper()->addIntegral(); return; - case Qt::Key_4: document->document()->wrapper()->addRoot(); return; - case Qt::Key_5: document->document()->wrapper()->addFraction(); return; - case Qt::Key_6: document->document()->wrapper()->addMatrix(); return; - case Qt::Key_7: document->document()->wrapper()->addOneByTwoMatrix(); return; - case Qt::Key_8: document->document()->wrapper()->addOverline(); return; - case Qt::Key_9: document->document()->wrapper()->addUnderline(); return; - case Qt::Key_A: slotSelectAll(); return; - case Qt::Key_B: document->document()->wrapper()->appendRow(); return; - case Qt::Key_C: document->document()->wrapper()->copy(); return; - case Qt::Key_D: document->document()->wrapper()->removeEnclosing(); return; - case Qt::Key_G: document->document()->wrapper()->makeGreek(); return; - case Qt::Key_I: document->document()->wrapper()->insertRow(); return; - case Qt::Key_R: document->document()->wrapper()->removeRow(); return; - case Qt::Key_K: document->document()->wrapper()->addMultiline(); return; - case Qt::Key_L: document->document()->wrapper()->addGenericLowerIndex(); return; - case Qt::Key_M: loadMathML( document, "test.mml" ); return; - case Qt::Key_O: load( document->document(), "test.xml" ); return; - case Qt::Key_Q: kapp->quit(); return; - case Qt::Key_S: save( "test.xml", document->document()->saveXML() ); return; - case Qt::Key_T: std::cout << document->texString().latin1() << std::endl; return; - case Qt::Key_U: document->document()->wrapper()->addGenericUpperIndex(); return; - case Qt::Key_V: document->document()->wrapper()->paste(); return; - case Qt::Key_X: document->document()->wrapper()->cut(); return; - case Qt::Key_Z: document->document()->wrapper()->undo(); return; + case TQt::Key_1: document->document()->wrapper()->addSum(); return; + case TQt::Key_2: document->document()->wrapper()->addProduct(); return; + case TQt::Key_3: document->document()->wrapper()->addIntegral(); return; + case TQt::Key_4: document->document()->wrapper()->addRoot(); return; + case TQt::Key_5: document->document()->wrapper()->addFraction(); return; + case TQt::Key_6: document->document()->wrapper()->addMatrix(); return; + case TQt::Key_7: document->document()->wrapper()->addOneByTwoMatrix(); return; + case TQt::Key_8: document->document()->wrapper()->addOverline(); return; + case TQt::Key_9: document->document()->wrapper()->addUnderline(); return; + case TQt::Key_A: slotSelectAll(); return; + case TQt::Key_B: document->document()->wrapper()->appendRow(); return; + case TQt::Key_C: document->document()->wrapper()->copy(); return; + case TQt::Key_D: document->document()->wrapper()->removeEnclosing(); return; + case TQt::Key_G: document->document()->wrapper()->makeGreek(); return; + case TQt::Key_I: document->document()->wrapper()->insertRow(); return; + case TQt::Key_R: document->document()->wrapper()->removeRow(); return; + case TQt::Key_K: document->document()->wrapper()->addMultiline(); return; + case TQt::Key_L: document->document()->wrapper()->addGenericLowerIndex(); return; + case TQt::Key_M: loadMathML( document, "test.mml" ); return; + case TQt::Key_O: load( document->document(), "test.xml" ); return; + case TQt::Key_Q: kapp->quit(); return; + case TQt::Key_S: save( "test.xml", document->document()->saveXML() ); return; + case TQt::Key_T: std::cout << document->texString().latin1() << std::endl; return; + case TQt::Key_U: document->document()->wrapper()->addGenericUpperIndex(); return; + case TQt::Key_V: document->document()->wrapper()->paste(); return; + case TQt::Key_X: document->document()->wrapper()->cut(); return; + case TQt::Key_Z: document->document()->wrapper()->undo(); return; default: //std::cerr << "Key: " << event->key() << std::endl; break; @@ -201,19 +201,19 @@ void TestWidget::keyPressEvent(QKeyEvent* event) ScrollView::ScrollView() - : QScrollView(), child(0) + : TQScrollView(), child(0) { } void ScrollView::addChild(KFormulaWidget* c, int x, int y) { - QScrollView::addChild(c, x, y); + TQScrollView::addChild(c, x, y); child = c; - connect(child, SIGNAL(cursorChanged(bool, bool)), - this, SLOT(cursorChanged(bool, bool))); + connect(child, TQT_SIGNAL(cursorChanged(bool, bool)), + this, TQT_SLOT(cursorChanged(bool, bool))); } -void ScrollView::focusInEvent(QFocusEvent*) +void ScrollView::focusInEvent(TQFocusEvent*) { if (child != 0) child->setFocus(); } @@ -246,7 +246,7 @@ int main(int argc, char** argv) KApplication app; - app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); + app.connect(&app, TQT_SIGNAL(lastWindowClosed()), &app, TQT_SLOT(quit())); DocumentWrapper* wrapper = new DocumentWrapper( kapp->config(), 0 ); Document* document = new Document; @@ -263,7 +263,7 @@ int main(int argc, char** argv) KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); for ( int i = 0; i < args->count(); ++i ) { - QFileInfo fi( args->url( i ).path() ); + TQFileInfo fi( args->url( i ).path() ); if ( fi.extension() == "mml" ) loadMathML( container1, args->url( i ).path() ); else if ( fi.extension() == "xml" ) @@ -277,7 +277,7 @@ int main(int argc, char** argv) // Make sure there are no elements in the clipboard. // Okey for a debug app. - QApplication::clipboard()->clear(); + TQApplication::tqclipboard()->clear(); int destruct = BasicElement::getEvilDestructionCount(); if (destruct != 0) { |