diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
commit | 0a6e0958c03e41c87b15557b6f407874f20c2f8d (patch) | |
tree | 2cdd58c4013b1be09cfcbb4ddae2b05712b9aeee /keduca/keducabuilder/keducabuilder.cpp | |
parent | 83f9dfafc157ff7823804b3ff457b43d021a5b4b (diff) | |
download | tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.tar.gz tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'keduca/keducabuilder/keducabuilder.cpp')
-rw-r--r-- | keduca/keducabuilder/keducabuilder.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/keduca/keducabuilder/keducabuilder.cpp b/keduca/keducabuilder/keducabuilder.cpp index 08487cc9..fa7da986 100644 --- a/keduca/keducabuilder/keducabuilder.cpp +++ b/keduca/keducabuilder/keducabuilder.cpp @@ -32,10 +32,10 @@ #include <kmessagebox.h> #include <kprinter.h> -#include <qlayout.h> -#include <qcheckbox.h> -#include <qpaintdevicemetrics.h> -#include <qpainter.h> +#include <tqlayout.h> +#include <tqcheckbox.h> +#include <tqpaintdevicemetrics.h> +#include <tqpainter.h> static const char* const keducabuilder_data[] = { "15 16 4 1", @@ -60,7 +60,7 @@ static const char* const keducabuilder_data[] = { ".#############.", "..............."}; -KEducaBuilder::KEducaBuilder(QWidget* parent, const char *name, WFlags f ) +KEducaBuilder::KEducaBuilder(TQWidget* parent, const char *name, WFlags f ) : KMainWindow(parent,name,f), _nativeFormat("application/x-edu") { @@ -81,29 +81,29 @@ KEducaBuilder::~KEducaBuilder() /** Init graphical interface */ void KEducaBuilder::init() { - QWidget *mainView = new QWidget(this, "mainview"); + TQWidget *mainView = new TQWidget(this, "mainview"); - QVBoxLayout *form2Layout = new QVBoxLayout( mainView ); + TQVBoxLayout *form2Layout = new TQVBoxLayout( mainView ); form2Layout->setSpacing( 2 ); form2Layout->setMargin( 0 ); - _split = new QSplitter( mainView ); - _split->setOrientation( QSplitter::Vertical ); + _split = new TQSplitter( mainView ); + _split->setOrientation( TQSplitter::Vertical ); _listAnswer = new KListBox( _split, "_listAnswer" ); - _listAnswer->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, _listAnswer->sizePolicy().hasHeightForWidth() ) ); - connect( _listAnswer, SIGNAL( highlighted(QListBoxItem *) ), this, SLOT( slotPreview(QListBoxItem *) ) ); - connect( _listAnswer, SIGNAL( doubleClicked(QListBoxItem *) ), this, SLOT( slotEditbyList(QListBoxItem *) ) ); + _listAnswer->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, _listAnswer->sizePolicy().hasHeightForWidth() ) ); + connect( _listAnswer, TQT_SIGNAL( highlighted(TQListBoxItem *) ), this, TQT_SLOT( slotPreview(TQListBoxItem *) ) ); + connect( _listAnswer, TQT_SIGNAL( doubleClicked(TQListBoxItem *) ), this, TQT_SLOT( slotEditbyList(TQListBoxItem *) ) ); - _preview = new QTextView( _split, "_preview" ); - _preview->setFrameShape( QTextView::NoFrame ); + _preview = new TQTextView( _split, "_preview" ); + _preview->setFrameShape( TQTextView::NoFrame ); _preview->setLineWidth( 1 ); form2Layout->addWidget( _split ); setCentralWidget( mainView ); if (!initialGeometrySet()) - resize( QSize(500, 400).expandedTo(minimumSizeHint())); + resize( TQSize(500, 400).expandedTo(minimumSizeHint())); setupGUI( ToolBar | Keys | StatusBar | Create, "keducabuilderui.rc" ); setAutoSaveSettings(); } @@ -111,21 +111,21 @@ void KEducaBuilder::init() /** Init menu bar settings */ void KEducaBuilder::initMenuBar() { - KStdAction::openNew(this, SLOT( slotFileOpenNew() ), actionCollection()); - KStdAction::open (this, SLOT( slotFileOpen() ), actionCollection()); - (void)new KAction(i18n("Open &Gallery..."), 0, 0, this, SLOT( slotGallery() ), actionCollection(), "open_gallery"); - _recentFiles = KStdAction::openRecent(this, SLOT ( slotFileOpenURL(const KURL &)), actionCollection()); - KStdAction::save (this, SLOT( slotFileSave() ), actionCollection()); - KStdAction::saveAs (this, SLOT( slotFileSaveAs() ), actionCollection()); - KStdAction::print (this, SLOT( slotFilePrint() ), actionCollection()); - (void)new KAction(i18n("Document Info"), "info", 0, this, SLOT( slotHeader() ), actionCollection(), "info_doc"); - KStdAction::quit(this, SLOT( close() ), actionCollection()); - - (void)new KAction(i18n("&Add..."), "addquestion", 0, this, SLOT( slotAdd() ), actionCollection(), "question_add"); - (void)new KAction(i18n("&Edit..."), "editquestion", 0, this, SLOT( slotEdit() ), actionCollection(), "question_edit"); - (void)new KAction(i18n("&Remove"), "delquestion", 0, this, SLOT( slotRemove() ), actionCollection(), "question_remove"); - (void)new KAction(i18n("&Up"), "up", 0, this, SLOT( slotUp() ), actionCollection(), "question_up"); - (void)new KAction(i18n("&Down"), "down", 0, this, SLOT( slotDown() ), actionCollection(), "question_down"); + KStdAction::openNew(this, TQT_SLOT( slotFileOpenNew() ), actionCollection()); + KStdAction::open (this, TQT_SLOT( slotFileOpen() ), actionCollection()); + (void)new KAction(i18n("Open &Gallery..."), 0, 0, this, TQT_SLOT( slotGallery() ), actionCollection(), "open_gallery"); + _recentFiles = KStdAction::openRecent(this, TQT_SLOT ( slotFileOpenURL(const KURL &)), actionCollection()); + KStdAction::save (this, TQT_SLOT( slotFileSave() ), actionCollection()); + KStdAction::saveAs (this, TQT_SLOT( slotFileSaveAs() ), actionCollection()); + KStdAction::print (this, TQT_SLOT( slotFilePrint() ), actionCollection()); + (void)new KAction(i18n("Document Info"), "info", 0, this, TQT_SLOT( slotHeader() ), actionCollection(), "info_doc"); + KStdAction::quit(this, TQT_SLOT( close() ), actionCollection()); + + (void)new KAction(i18n("&Add..."), "addquestion", 0, this, TQT_SLOT( slotAdd() ), actionCollection(), "question_add"); + (void)new KAction(i18n("&Edit..."), "editquestion", 0, this, TQT_SLOT( slotEdit() ), actionCollection(), "question_edit"); + (void)new KAction(i18n("&Remove"), "delquestion", 0, this, TQT_SLOT( slotRemove() ), actionCollection(), "question_remove"); + (void)new KAction(i18n("&Up"), "up", 0, this, TQT_SLOT( slotUp() ), actionCollection(), "question_up"); + (void)new KAction(i18n("&Down"), "down", 0, this, TQT_SLOT( slotDown() ), actionCollection(), "question_down"); } /** Delete current document and start new */ @@ -148,7 +148,7 @@ void KEducaBuilder::slotFileOpenNew() /** Open new document. */ void KEducaBuilder::slotFileOpen() { - KURL url = KFileDialog::getOpenURL( QString::null, _nativeFormat, this, i18n("Open Educa File") ); + KURL url = KFileDialog::getOpenURL( TQString::null, _nativeFormat, this, i18n("Open Educa File") ); if( !url.isEmpty() ) slotFileOpenURL( url ); @@ -160,7 +160,7 @@ void KEducaBuilder::slotFileOpenURL( const KURL &url ) if (!currentFileMayBeReplaced()) return; - QPixmap image0( ( const char** ) keducabuilder_data ); + TQPixmap image0( ( const char** ) keducabuilder_data ); delete _keducaFile; _keducaFile = new FileRead(); if( !_keducaFile->openFile(url) ) { return; } @@ -177,10 +177,10 @@ void KEducaBuilder::slotFileOpenURL( const KURL &url ) } /** Item select */ -void KEducaBuilder::slotPreview( QListBoxItem *item ) +void KEducaBuilder::slotPreview( TQListBoxItem *item ) { // bool match = false; - QString tmpListanswer; + TQString tmpListanswer; // FIND THE SELECT RECORD if( !item ) return; @@ -318,7 +318,7 @@ bool KEducaBuilder::queryClose () /** Add question */ void KEducaBuilder::slotAdd() { - QPixmap image0( ( const char** ) keducabuilder_data ); + TQPixmap image0( ( const char** ) keducabuilder_data ); KControlAddEdit edit(this); edit.init( _keducaFile, false ); @@ -334,7 +334,7 @@ void KEducaBuilder::slotEdit() { if( _listAnswer->currentItem() == -1 ) return; - QPixmap image0( ( const char** ) keducabuilder_data ); + TQPixmap image0( ( const char** ) keducabuilder_data ); KControlAddEdit edit(this); edit.init( _keducaFile, true ); @@ -359,10 +359,10 @@ void KEducaBuilder::slotUp() int current = _listAnswer->currentItem(); if( current < 1 ) return; - QPixmap image0( ( const char** ) keducabuilder_data ); + TQPixmap image0( ( const char** ) keducabuilder_data ); _keducaFile->recordSwap( true ); - QString tmpString = _listAnswer->text( current-1 ); + TQString tmpString = _listAnswer->text( current-1 ); _listAnswer->changeItem( image0, _listAnswer->text( current ), current-1 ); _listAnswer->changeItem( image0, tmpString, current ); _listAnswer->setCurrentItem( current-1 ); @@ -374,10 +374,10 @@ void KEducaBuilder::slotDown() int current = _listAnswer->currentItem(); if( current == -1 || current == (signed)(_listAnswer->count()-1) ) return; - QPixmap image0( ( const char** ) keducabuilder_data ); + TQPixmap image0( ( const char** ) keducabuilder_data ); _keducaFile->recordSwap( true ); - QString tmpString = _listAnswer->text( current+1 ); + TQString tmpString = _listAnswer->text( current+1 ); _listAnswer->changeItem( image0, _listAnswer->text( current ), current+1 ); _listAnswer->changeItem( image0, tmpString, current ); _listAnswer->setCurrentItem( current+1 ); @@ -406,22 +406,22 @@ bool KEducaBuilder::fileSaveAs() { if( !checkSave() ) return false; - QCheckBox *saveCompressedCheckBox = new QCheckBox( i18n( "Compress the file" ), 0 ); + TQCheckBox *saveCompressedCheckBox = new TQCheckBox( i18n( "Compress the file" ), 0 ); saveCompressedCheckBox->setChecked( true ); - KFileDialog *dialog=new KFileDialog(QString::null, QString::null, this, "file dialog", true, saveCompressedCheckBox); + KFileDialog *dialog=new KFileDialog(TQString::null, TQString::null, this, "file dialog", true, saveCompressedCheckBox); dialog->setCaption( i18n("Save Document As") ); dialog->setKeepLocation( true ); dialog->setOperationMode( KFileDialog::Saving ); - QStringList mimeFilter(_nativeFormat); + TQStringList mimeFilter(_nativeFormat); dialog->setMimeFilter( mimeFilter, _nativeFormat ); KURL newURL; - QString outputFormat (_nativeFormat); + TQString outputFormat (_nativeFormat); bool bOk; do { bOk=true; - if(dialog->exec()==QDialog::Accepted) { + if(dialog->exec()==TQDialog::Accepted) { newURL=dialog->selectedURL(); outputFormat=dialog->currentMimeFilter(); } @@ -437,10 +437,10 @@ bool KEducaBuilder::fileSaveAs() break; } - if ( QFileInfo( newURL.path() ).extension().isEmpty() ) { + if ( TQFileInfo( newURL.path() ).extension().isEmpty() ) { // No more extensions in filters. We need to get it from the mimetype. KMimeType::Ptr mime = KMimeType::mimeType( outputFormat ); - QString extension = mime->property( "X-KDE-NativeExtension" ).toString(); + TQString extension = mime->property( "X-KDE-NativeExtension" ).toString(); kdDebug() << "KEducaBuilder::slotFileSaveAs outputFormat=" << outputFormat << " extension=" << extension << endl; newURL.setPath( newURL.path() + extension ); } @@ -482,21 +482,21 @@ void KEducaBuilder::slotFilePrint() { KPrinter *printer = new KPrinter(); - QString file = _keducaFile->getCurrentURL().fileName(); + TQString file = _keducaFile->getCurrentURL().fileName(); if (file.isEmpty()) file = i18n("Test"); if(printer->setup(this, i18n("Print %1").arg(file))) { - QPaintDeviceMetrics metrics(printer); - QPainter p; + TQPaintDeviceMetrics metrics(printer); + TQPainter p; const int margin=20; int yPos=0; - QString text; + TQString text; p.begin(printer); - p.setFont( QFont(font().family(), 12, QFont::Bold) ); - QFontMetrics fm = p.fontMetrics(); + p.setFont( TQFont(font().family(), 12, TQFont::Bold) ); + TQFontMetrics fm = p.fontMetrics(); _keducaFile->recordFirst(); while(!_keducaFile->recordEOF()) @@ -533,7 +533,7 @@ bool KEducaBuilder::checkSave() _keducaFile->getHeader("level").isEmpty() || _keducaFile->getHeader("language").isEmpty() ) { - if (KMessageBox::warningContinueCancel(this, i18n("Unable to save file.\n\nYou must complete the Document Info\n(Only the description is necessary)"), QString::null, i18n("Complete Document Info...")) + if (KMessageBox::warningContinueCancel(this, i18n("Unable to save file.\n\nYou must complete the Document Info\n(Only the description is necessary)"), TQString::null, i18n("Complete Document Info...")) == KMessageBox::Continue) { if (slotHeader()!=KControlHeader::Accepted) return false; @@ -544,7 +544,7 @@ bool KEducaBuilder::checkSave() if( _listAnswer->count() < 1 ) { if (KMessageBox::warningContinueCancel(this, i18n("Unable to save file.\n\nYou must insert a question."), - QString::null, i18n("Insert Question"))==KMessageBox::Continue) + TQString::null, i18n("Insert Question"))==KMessageBox::Continue) slotAdd(); else return false; @@ -582,7 +582,7 @@ void KEducaBuilder::initGallery(const KURL &urlFile) if( !urlFile.url().isEmpty() ) galleries.putURL( urlFile ); - if( galleries.exec() == QDialog::Accepted ) + if( galleries.exec() == TQDialog::Accepted ) slotFileOpenURL( galleries.getURL() ); } @@ -593,7 +593,7 @@ void KEducaBuilder::slotGallery() } /** Double click in list, edit question */ -void KEducaBuilder::slotEditbyList(QListBoxItem *item) +void KEducaBuilder::slotEditbyList(TQListBoxItem *item) { if( item ) slotEdit(); |