diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 19:59:21 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 19:59:21 +0000 |
commit | b9c374725620ec064db7610132a8b8969fa405b9 (patch) | |
tree | 645c03144cac22f7b4fb5bd10985d389e8954290 /src/kile/configcodecompletion.cpp | |
parent | 71729070d61b36b96acd7fa9c34bba0cb8f58c3b (diff) | |
download | kile-b9c374725620ec064db7610132a8b8969fa405b9.tar.gz kile-b9c374725620ec064db7610132a8b8969fa405b9.zip |
TQt4 port kile
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kile@1239285 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kile/configcodecompletion.cpp')
-rw-r--r-- | src/kile/configcodecompletion.cpp | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/src/kile/configcodecompletion.cpp b/src/kile/configcodecompletion.cpp index 8cd952e..ad400f2 100644 --- a/src/kile/configcodecompletion.cpp +++ b/src/kile/configcodecompletion.cpp @@ -22,37 +22,37 @@ #include <kmessagebox.h> #include <klocale.h> -#include <qlayout.h> -#include <qtabwidget.h> -#include <qgroupbox.h> -#include <qvgroupbox.h> -#include <qbuttongroup.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qframe.h> -#include <qwhatsthis.h> -#include <qstringlist.h> -#include <qfileinfo.h> -#include <qdir.h> +#include <tqlayout.h> +#include <tqtabwidget.h> +#include <tqgroupbox.h> +#include <tqvgroupbox.h> +#include <tqbuttongroup.h> +#include <tqlabel.h> +#include <tqspinbox.h> +#include <tqframe.h> +#include <tqwhatsthis.h> +#include <tqstringlist.h> +#include <tqfileinfo.h> +#include <tqdir.h> #include "kilelistselector.h" #include "kileconfig.h" #include "kilelogwidget.h" #include "kiletool_enums.h" -ConfigCodeCompletion::ConfigCodeCompletion(KConfig *config, KileWidget::LogMsg *logwidget, QWidget *parent, const char *name ) - : QWidget(parent,name), m_config(config), m_logwidget(logwidget) +ConfigCodeCompletion::ConfigCodeCompletion(KConfig *config, KileWidget::LogMsg *logwidget, TQWidget *tqparent, const char *name ) + : TQWidget(tqparent,name), m_config(config), m_logwidget(logwidget) { // Layout - QVBoxLayout *vbox = new QVBoxLayout(this, 5,KDialog::spacingHint() ); + TQVBoxLayout *vbox = new TQVBoxLayout(this, 5,KDialog::spacingHint() ); // Groupbox with TabDialog and two button - QGroupBox *gb_tab= new QGroupBox(i18n("Complete Modes"), this ); - QGridLayout *grid_tab = new QGridLayout( gb_tab, 2,1, 12,8, "" ); + TQGroupBox *gb_tab= new TQGroupBox(i18n("Complete Modes"), this ); + TQGridLayout *grid_tab = new TQGridLayout( gb_tab, 2,1, 12,8, "" ); grid_tab->addRowSpacing( 0, 12 ); // create TabWidget - tab = new QTabWidget(gb_tab); + tab = new TQTabWidget(gb_tab); // add three pages: Tex/Latex, Dictionary, Abbreviation addPage(tab, TexPage, i18n("TeX/LaTeX"), "tex"); @@ -64,32 +64,32 @@ ConfigCodeCompletion::ConfigCodeCompletion(KConfig *config, KileWidget::LogMsg * remove = new KPushButton(i18n("Remove"),gb_tab); grid_tab->addMultiCellWidget(tab,1,1,0,1); - grid_tab->addWidget(add,2,0,Qt::AlignRight); - grid_tab->addWidget(remove,2,1,Qt::AlignLeft); + grid_tab->addWidget(add,2,0,TQt::AlignRight); + grid_tab->addWidget(remove,2,1,TQt::AlignLeft); // below: OptionBox - QButtonGroup *bg_options = new QButtonGroup( this, "bgOptions" ); + TQButtonGroup *bg_options = new TQButtonGroup( this, "bgOptions" ); bg_options->setColumnLayout(0, Qt::Vertical ); - bg_options->layout()->setSpacing( 6 ); - bg_options->layout()->setMargin( 11 ); - QGridLayout *bg_optionsLayout = new QGridLayout( bg_options->layout() ); - bg_optionsLayout->setAlignment( Qt::AlignTop ); - - cb_setcursor = new QCheckBox(i18n("Place cursor"),bg_options); - cb_setbullets = new QCheckBox(i18n("Insert bullets"),bg_options); - cb_closeenv = new QCheckBox(i18n("Close environments"),bg_options); - cb_usecomplete = new QCheckBox(i18n("Use complete"),bg_options); - cb_autocomplete = new QCheckBox(i18n("Auto completion (LaTeX)"),bg_options); - lb_latexthreshold = new QLabel(i18n("Threshold:"),bg_options); - sp_latexthreshold = new QSpinBox(1,9,1,bg_options); - QLabel *lb_latexletters = new QLabel(i18n("letters"),bg_options); - cb_autocompletetext = new QCheckBox(i18n("Auto completion (text)"),bg_options); - lb_textthreshold = new QLabel(i18n("Threshold:"),bg_options); - sp_textthreshold = new QSpinBox(1,9,1,bg_options); - QLabel *lb_textletters = new QLabel(i18n("letters"),bg_options); - cb_showabbrevview = new QCheckBox(i18n("Show abbreviations"),bg_options); - cb_autocompleteabbrev = new QCheckBox(i18n("Auto completion (abbrev.)"),bg_options); - cb_citeoutofbraces = new QCheckBox(i18n("Move out of braces (citation keylists)"),bg_options); + bg_options->tqlayout()->setSpacing( 6 ); + bg_options->tqlayout()->setMargin( 11 ); + TQGridLayout *bg_optionsLayout = new TQGridLayout( bg_options->tqlayout() ); + bg_optionsLayout->tqsetAlignment( TQt::AlignTop ); + + cb_setcursor = new TQCheckBox(i18n("Place cursor"),bg_options); + cb_setbullets = new TQCheckBox(i18n("Insert bullets"),bg_options); + cb_closeenv = new TQCheckBox(i18n("Close environments"),bg_options); + cb_usecomplete = new TQCheckBox(i18n("Use complete"),bg_options); + cb_autocomplete = new TQCheckBox(i18n("Auto completion (LaTeX)"),bg_options); + lb_latexthreshold = new TQLabel(i18n("Threshold:"),bg_options); + sp_latexthreshold = new TQSpinBox(1,9,1,bg_options); + TQLabel *lb_latexletters = new TQLabel(i18n("letters"),bg_options); + cb_autocompletetext = new TQCheckBox(i18n("Auto completion (text)"),bg_options); + lb_textthreshold = new TQLabel(i18n("Threshold:"),bg_options); + sp_textthreshold = new TQSpinBox(1,9,1,bg_options); + TQLabel *lb_textletters = new TQLabel(i18n("letters"),bg_options); + cb_showabbrevview = new TQCheckBox(i18n("Show abbreviations"),bg_options); + cb_autocompleteabbrev = new TQCheckBox(i18n("Auto completion (abbrev.)"),bg_options); + cb_citeoutofbraces = new TQCheckBox(i18n("Move out of braces (citation keylists)"),bg_options); bg_optionsLayout->addWidget(cb_setcursor,0,0); bg_optionsLayout->addWidget(cb_setbullets,1,0); @@ -107,37 +107,37 @@ ConfigCodeCompletion::ConfigCodeCompletion(KConfig *config, KileWidget::LogMsg * bg_optionsLayout->addWidget(cb_autocompleteabbrev,3,2); bg_optionsLayout->addMultiCellWidget(cb_citeoutofbraces,4,4,0,7); - // tune layout + // tune tqlayout bg_optionsLayout->setColSpacing(1,20); bg_optionsLayout->setColSpacing(3,12); bg_optionsLayout->setColSpacing(5,8); bg_optionsLayout->setColStretch(7,1); - QWhatsThis::add(cb_setcursor,i18n("Try to place the cursor.")); - QWhatsThis::add(cb_setbullets,i18n("Insert bullets, where the user must input data.")); - QWhatsThis::add(cb_closeenv,i18n("Also close an environment, when an opening command is inserted.")); - QWhatsThis::add(cb_usecomplete,i18n("Enable components of word completion.")); - QWhatsThis::add(cb_autocomplete,i18n("Directional or popup-based completion with TeX/LaTeX commands, which are given in all selected word completion lists. This mode can only be selected, if no other plugin for autocompletion is active.")); - QWhatsThis::add(cb_autocompletetext,i18n("Directional or popup-based completion from words in the current document. This mode can only be selected, if no other plugin for autocompletion is active.")); - QWhatsThis::add(sp_latexthreshold,i18n("Automatically show a completion list of TeX/LaTeX commands, when the word has this length.")); - QWhatsThis::add(sp_textthreshold,i18n("Automatically show a completion list, when the word has this length.")); - QWhatsThis::add(cb_citeoutofbraces,i18n("Move cursor out of braces after selecting from a citation keylist.")); + TQWhatsThis::add(cb_setcursor,i18n("Try to place the cursor.")); + TQWhatsThis::add(cb_setbullets,i18n("Insert bullets, where the user must input data.")); + TQWhatsThis::add(cb_closeenv,i18n("Also close an environment, when an opening command is inserted.")); + TQWhatsThis::add(cb_usecomplete,i18n("Enable components of word completion.")); + TQWhatsThis::add(cb_autocomplete,i18n("Directional or popup-based completion with TeX/LaTeX commands, which are given in all selected word completion lists. This mode can only be selected, if no other plugin for autocompletion is active.")); + TQWhatsThis::add(cb_autocompletetext,i18n("Directional or popup-based completion from words in the current document. This mode can only be selected, if no other plugin for autocompletion is active.")); + TQWhatsThis::add(sp_latexthreshold,i18n("Automatically show a completion list of TeX/LaTeX commands, when the word has this length.")); + TQWhatsThis::add(sp_textthreshold,i18n("Automatically show a completion list, when the word has this length.")); + TQWhatsThis::add(cb_citeoutofbraces,i18n("Move cursor out of braces after selecting from a citation keylist.")); // bottom: warning - QLabel *lb_automodes = new QLabel(i18n("Warning: all autocompletion modes will be disabled, if you enable KTextEditor plugin word completion."),this); + TQLabel *lb_automodes = new TQLabel(i18n("Warning: all autocompletion modes will be disabled, if you enable KTextEditor plugin word completion."),this); - // add OptionBox and TabDialog into the layout + // add OptionBox and TabDialog into the tqlayout vbox->addWidget(gb_tab); vbox->addWidget(bg_options); vbox->addWidget(lb_automodes); vbox->addStretch(); - connect(tab,SIGNAL(currentChanged(QWidget*)),this,SLOT(showPage(QWidget*))); - connect(add,SIGNAL(clicked()),this,SLOT(addClicked())); - connect(remove,SIGNAL(clicked()),this,SLOT(removeClicked())); + connect(tab,TQT_SIGNAL(currentChanged(TQWidget*)),this,TQT_SLOT(showPage(TQWidget*))); + connect(add,TQT_SIGNAL(clicked()),this,TQT_SLOT(addClicked())); + connect(remove,TQT_SIGNAL(clicked()),this,TQT_SLOT(removeClicked())); // justify height - QCheckListItem *item = new QCheckListItem(m_listview[AbbreviationPage], "Test", QCheckListItem::CheckBox); + TQCheckListItem *item = new TQCheckListItem(m_listview[AbbreviationPage], "Test", TQCheckListItem::CheckBox); int h = 6*(item->height()+1) + 1; for ( uint i=TexPage; i<NumPages; ++i ) m_listview[i]->setFixedHeight(h); @@ -151,16 +151,16 @@ ConfigCodeCompletion::~ConfigCodeCompletion() { } -void ConfigCodeCompletion::addPage(QTabWidget *tab, CompletionPage page, const QString &title, const QString &dirname) +void ConfigCodeCompletion::addPage(TQTabWidget *tab, CompletionPage page, const TQString &title, const TQString &dirname) { - m_page[page] = new QWidget(tab); + m_page[page] = new TQWidget(tab); m_listview[page] = new KListView( m_page[page] ); m_listview[page]->addColumn(i18n("Complete Files")); m_listview[page]->addColumn(i18n("Local File")); m_listview[page]->setFullWidth(true); - QGridLayout *grid = new QGridLayout(m_page[page], 1,1, 10,10); + TQGridLayout *grid = new TQGridLayout(m_page[page], 1,1, 10,10); grid->addWidget(m_listview[page],0,0); // add Tab @@ -169,7 +169,7 @@ void ConfigCodeCompletion::addPage(QTabWidget *tab, CompletionPage page, const Q // remember directory name m_dirname << dirname; - connect(m_listview[page], SIGNAL(clicked( QListViewItem *)), this, SLOT(slotListviewClicked(QListViewItem *))); + connect(m_listview[page], TQT_SIGNAL(clicked( TQListViewItem *)), this, TQT_SLOT(slotListviewClicked(TQListViewItem *))); } //////////////////// read/write configuration //////////////////// @@ -240,7 +240,7 @@ void ConfigCodeCompletion::writeConfig(void) { if ( autoModeLatex || autoModeText || autoModeAbbrev) { - QString msg = i18n("You enabled the KTextEditor-Plugin for word completion, " + TQString msg = i18n("You enabled the KTextEditor-Plugin for word completion, " "but this conflicts with the auto completion modes of Kile. " "As only one of these completion modes can be used, the " "autocompletion modes of Kile will be disabled."); @@ -277,26 +277,26 @@ bool ConfigCodeCompletion::kateCompletionPlugin() void ConfigCodeCompletion::setListviewEntries(CompletionPage page) { - QString listname = m_dirname[page]; - QString localdir = m_localCwlDir + listname + '/'; - QString globaldir = m_globalCwlDir + listname + '/'; + TQString listname = m_dirname[page]; + TQString localdir = m_localCwlDir + listname + '/'; + TQString globaldir = m_globalCwlDir + listname + '/'; // Daten aus der Konfigurationsliste in das ListView-Widget eintragen m_listview[page]->setUpdatesEnabled(false); m_listview[page]->clear(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it=m_wordlist[page].begin(); it!=m_wordlist[page].end(); ++it ) { - QString basename = (*it).right( (*it).length()-2 ); - bool localExists = QFileInfo(localdir+basename+".cwl").exists(); + TQString basename = (*it).right( (*it).length()-2 ); + bool localExists = TQFileInfo(localdir+basename+".cwl").exists(); - QCheckListItem *item = new QCheckListItem(m_listview[page],basename,QCheckListItem::CheckBox); + TQCheckListItem *item = new TQCheckListItem(m_listview[page],basename,TQCheckListItem::CheckBox); if ( localExists ) { item->setOn( (*it).at(0) == '1' ? true : false ); item->setText(1,"+"); } - else if ( QFileInfo(globaldir+basename+".cwl").exists() ) + else if ( TQFileInfo(globaldir+basename+".cwl").exists() ) { item->setOn( (*it).at(0) == '1' ? true : false ); } @@ -335,11 +335,11 @@ bool ConfigCodeCompletion::getListviewEntries(CompletionPage page) } // now check all entries if they have changed - QStringList newfiles; + TQStringList newfiles; int index = 0; - QCheckListItem *item = (QCheckListItem *)m_listview[page]->firstChild(); + TQCheckListItem *item = (TQCheckListItem *)m_listview[page]->firstChild(); while ( item ) { - QString s = ( item->isOn() ) ? "1-" : "0-"; + TQString s = ( item->isOn() ) ? "1-" : "0-"; s += item->text(0); newfiles.append(s); @@ -348,7 +348,7 @@ bool ConfigCodeCompletion::getListviewEntries(CompletionPage page) changed = true; // go on - item = (QCheckListItem *)item->nextSibling(); + item = (TQCheckListItem *)item->nextSibling(); ++index; } @@ -359,21 +359,21 @@ bool ConfigCodeCompletion::getListviewEntries(CompletionPage page) return changed; } -bool ConfigCodeCompletion::isListviewEntry(KListView *listview, const QString &filename) +bool ConfigCodeCompletion::isListviewEntry(KListView *listview, const TQString &filename) { - QCheckListItem *item = (QCheckListItem *)listview->firstChild(); + TQCheckListItem *item = (TQCheckListItem *)listview->firstChild(); while ( item ) { if ( item->text() == filename ) return true; - item = (QCheckListItem *)item->nextSibling(); + item = (TQCheckListItem *)item->nextSibling(); } return false; } //////////////////// tabpages parameter //////////////////// -KListView *ConfigCodeCompletion::getListview(QWidget *page) +KListView *ConfigCodeCompletion::getListview(TQWidget *page) { for ( uint i=TexPage; i<NumPages; ++i ) { @@ -383,19 +383,19 @@ KListView *ConfigCodeCompletion::getListview(QWidget *page) return 0; } -QString ConfigCodeCompletion::getListname(QWidget *page) +TQString ConfigCodeCompletion::getListname(TQWidget *page) { for ( uint i=TexPage; i<NumPages; ++i ) { if ( page == m_page[i] ) return m_dirname[i]; } - return QString::null; + return TQString(); } //////////////////// shwo tabpages //////////////////// -void ConfigCodeCompletion::showPage(QWidget *page) +void ConfigCodeCompletion::showPage(TQWidget *page) { KListView *listview = getListview(page); if ( listview ) @@ -409,10 +409,10 @@ void ConfigCodeCompletion::showPage(QWidget *page) void ConfigCodeCompletion::getCwlDirs() { m_localCwlDir = locateLocal("appdata","complete/"); - m_globalCwlDir = QString::null; + m_globalCwlDir = TQString(); - QStringList dirs = KGlobal::dirs()->findDirs("appdata","complete/"); - for ( QStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it ) + TQStringList dirs = KGlobal::dirs()->findDirs("appdata","complete/"); + for ( TQStringList::ConstIterator it=dirs.begin(); it!=dirs.end(); ++it ) { if ( (*it) != m_localCwlDir ) { @@ -427,13 +427,13 @@ void ConfigCodeCompletion::getCwlDirs() // with filename as key and filepath as value. Additionally all // filenames are added to a stringlist. -void ConfigCodeCompletion::getCwlFiles(QMap<QString,QString> &map, QStringList &list, const QString &dir) +void ConfigCodeCompletion::getCwlFiles(TQMap<TQString,TQString> &map, TQStringList &list, const TQString &dir) { - QStringList files = QDir(dir,"*.cwl").entryList(); - for ( QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) + TQStringList files = TQDir(dir,"*.cwl").entryList(); + for ( TQStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { - QString filename = QFileInfo(*it).fileName(); - if ( ! map.contains(filename) ) + TQString filename = TQFileInfo(*it).fileName(); + if ( ! map.tqcontains(filename) ) { map[filename] = dir + '/' + (*it); list << filename; @@ -444,12 +444,12 @@ void ConfigCodeCompletion::getCwlFiles(QMap<QString,QString> &map, QStringList & void ConfigCodeCompletion::addClicked() { // determine current subdirectory for current tab page - QString listname = getListname(tab->currentPage()); + TQString listname = getListname(tab->currentPage()); // get a sorted list of all cwl files from both directories - QMap<QString,QString> filemap; - QStringList filelist; + TQMap<TQString,TQString> filemap; + TQStringList filelist; getCwlFiles(filemap,filelist,m_localCwlDir+listname); getCwlFiles(filemap,filelist,m_globalCwlDir+listname); filelist.sort(); @@ -461,25 +461,25 @@ void ConfigCodeCompletion::addClicked() if ( dlg->currentItem() >= 0 ) { KListView *listview = getListview(tab->currentPage()); // get current page - QStringList filenames = dlg->selected(); // get selected files - for ( QStringList::ConstIterator it=filenames.begin(); it!=filenames.end(); ++it ) + TQStringList filenames = dlg->selected(); // get selected files + for ( TQStringList::ConstIterator it=filenames.begin(); it!=filenames.end(); ++it ) { - QString filename = *it; + TQString filename = *it; // could we accept the wordlist? - QFileInfo fi( filemap[filename] ); + TQFileInfo fi( filemap[filename] ); if ( !filename.isEmpty() && fi.exists() && fi.isReadable() ) { - QString basename = filename.left(filename.length()-4); + TQString basename = filename.left(filename.length()-4); // check if this entry already exists if ( isListviewEntry(listview,basename) ) { - m_logwidget->printMsg(KileTool::Info,i18n("Wordlist '%1' is already used.").arg(basename),i18n("Complete")); + m_logwidget->printMsg(KileTool::Info,i18n("Wordlist '%1' is already used.").tqarg(basename),i18n("Complete")); continue; } // add new entry - QCheckListItem *item = new QCheckListItem(listview,basename,QCheckListItem::CheckBox); + TQCheckListItem *item = new TQCheckListItem(listview,basename,TQCheckListItem::CheckBox); item->setOn(true); item->setSelected(true); if ( filemap[filename].left(m_localCwlDir.length()) == m_localCwlDir ) @@ -499,9 +499,9 @@ void ConfigCodeCompletion::addClicked() void ConfigCodeCompletion::removeClicked() { - QWidget *page = tab->currentPage(); + TQWidget *page = tab->currentPage(); KListView *list = getListview(page); // determine page - QCheckListItem *item = (QCheckListItem *)list->selectedItem(); // determine entry + TQCheckListItem *item = (TQCheckListItem *)list->selectedItem(); // determine entry if ( item ) { @@ -512,7 +512,7 @@ void ConfigCodeCompletion::removeClicked() } } -void ConfigCodeCompletion::slotListviewClicked(QListViewItem *) +void ConfigCodeCompletion::slotListviewClicked(TQListViewItem *) { KListView *listview = getListview(tab->currentPage()); // get current page remove->setEnabled( listview->selectedItems().count() > 0 ); |