diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/fileview/filegroupswidget.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/fileview/filegroupswidget.cpp')
-rw-r--r-- | parts/fileview/filegroupswidget.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/parts/fileview/filegroupswidget.cpp b/parts/fileview/filegroupswidget.cpp index 9f32460d..a31cb963 100644 --- a/parts/fileview/filegroupswidget.cpp +++ b/parts/fileview/filegroupswidget.cpp @@ -11,12 +11,12 @@ #include "filegroupswidget.h" -#include <qfileinfo.h> -#include <qdir.h> -#include <qheader.h> -#include <qtimer.h> -#include <qvbox.h> -#include <qregexp.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqheader.h> +#include <tqtimer.h> +#include <tqvbox.h> +#include <tqregexp.h> #include <kdebug.h> #include <kdialogbase.h> @@ -49,53 +49,53 @@ class FileComparator { public: virtual ~FileComparator(){ }; - virtual bool matches(const QString& name) const = 0; + virtual bool matches(const TQString& name) const = 0; }; class RegExpComparator : public FileComparator { public: - RegExpComparator(const QString& pattern) : m_exp(pattern, true, true){ + RegExpComparator(const TQString& pattern) : m_exp(pattern, true, true){ } - bool matches(const QString& name) const{ + bool matches(const TQString& name) const{ return m_exp.exactMatch(name); } private: - const QRegExp m_exp; + const TQRegExp m_exp; }; class EndingComparator : public FileComparator { public: - EndingComparator(const QString& pattern) : m_pattern ( pattern){ + EndingComparator(const TQString& pattern) : m_pattern ( pattern){ } - bool matches(const QString& name) const{ + bool matches(const TQString& name) const{ return name.endsWith(m_pattern); } private: - const QString m_pattern; + const TQString m_pattern; }; class FileViewFolderItem : public QListViewItem { public: - FileViewFolderItem(QListView *parent, const QString &name, const QString &pattern); - bool matches(const QString &fileName); + FileViewFolderItem(TQListView *parent, const TQString &name, const TQString &pattern); + bool matches(const TQString &fileName); private: - QPtrList<FileComparator> m_patterns; + TQPtrList<FileComparator> m_patterns; }; -FileViewFolderItem::FileViewFolderItem(QListView *parent, const QString &name, const QString &pattern) - : QListViewItem(parent, name) +FileViewFolderItem::FileViewFolderItem(TQListView *parent, const TQString &name, const TQString &pattern) + : TQListViewItem(parent, name) { setPixmap(0, SmallIcon("folder")); m_patterns.setAutoDelete(true); - QStringList patternstring = QStringList::split(';', pattern); - QStringList::ConstIterator theend = patternstring.end(); - for (QStringList::ConstIterator ci = patternstring.begin(); ci != theend; ++ci) + TQStringList patternstring = TQStringList::split(';', pattern); + TQStringList::ConstIterator theend = patternstring.end(); + for (TQStringList::ConstIterator ci = patternstring.begin(); ci != theend; ++ci) { - QString pattern = *ci; - QString tail = pattern.right( pattern.length() - 1 ); + TQString pattern = *ci; + TQString tail = pattern.right( pattern.length() - 1 ); if ( (tail).contains('*') || pattern.contains('?') || pattern.contains('[') || pattern.contains(']') ) { @@ -116,13 +116,13 @@ FileViewFolderItem::FileViewFolderItem(QListView *parent, const QString &name, c } -bool FileViewFolderItem::matches(const QString &fileName) +bool FileViewFolderItem::matches(const TQString &fileName) { // Test with the file path, so that "*ClientServer/*.h" patterns work - QString fName = QFileInfo(fileName).filePath(); + TQString fName = TQFileInfo(fileName).filePath(); - QPtrList<FileComparator>::ConstIterator theend = m_patterns.end(); - for (QPtrList<FileComparator>::ConstIterator ci = m_patterns.begin(); ci != theend; ++ci) + TQPtrList<FileComparator>::ConstIterator theend = m_patterns.end(); + for (TQPtrList<FileComparator>::ConstIterator ci = m_patterns.begin(); ci != theend; ++ci) if ((*ci)->matches(fName)) return true; @@ -133,20 +133,20 @@ bool FileViewFolderItem::matches(const QString &fileName) class FileGroupsFileItem : public QListViewItem { public: - FileGroupsFileItem(QListViewItem *parent, const QString &fileName); - QString fileName() const + FileGroupsFileItem(TQListViewItem *parent, const TQString &fileName); + TQString fileName() const { return fullname; } private: - QString fullname; + TQString fullname; }; -FileGroupsFileItem::FileGroupsFileItem(QListViewItem *parent, const QString &fileName) - : QListViewItem(parent), fullname(fileName) +FileGroupsFileItem::FileGroupsFileItem(TQListViewItem *parent, const TQString &fileName) + : TQListViewItem(parent), fullname(fileName) { setPixmap(0, SmallIcon("document")); - QFileInfo fi(fileName); + TQFileInfo fi(fileName); setText(0, fi.fileName()); setText(1, "./" + fi.dirPath()); } @@ -164,33 +164,33 @@ FileGroupsWidget::FileGroupsWidget(FileGroupsPart *part) setFocusPolicy(ClickFocus); setRootIsDecorated(true); - setResizeMode(QListView::LastColumn); + setResizeMode(TQListView::LastColumn); setSorting(-1); addColumn(i18n("Name")); setAllColumnsShowFocus( true ); // addColumn(i18n("Location")); - connect( this, SIGNAL(executed(QListViewItem*)), - this, SLOT(slotItemExecuted(QListViewItem*)) ); - connect( this, SIGNAL(returnPressed(QListViewItem*)), - this, SLOT(slotItemExecuted(QListViewItem*)) ); - connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) ); + connect( this, TQT_SIGNAL(executed(TQListViewItem*)), + this, TQT_SLOT(slotItemExecuted(TQListViewItem*)) ); + connect( this, TQT_SIGNAL(returnPressed(TQListViewItem*)), + this, TQT_SLOT(slotItemExecuted(TQListViewItem*)) ); + connect( this, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)), + this, TQT_SLOT(slotContextMenu(KListView*, TQListViewItem*, const TQPoint&)) ); m_actionToggleShowNonProjectFiles = new KToggleAction( i18n("Show Non Project Files"), KShortcut(), - this, SLOT(slotToggleShowNonProjectFiles()), this, "actiontoggleshowshownonprojectfiles" ); + this, TQT_SLOT(slotToggleShowNonProjectFiles()), this, "actiontoggleshowshownonprojectfiles" ); m_actionToggleShowNonProjectFiles->setCheckedState(i18n("Hide Non Project Files")); m_actionToggleShowNonProjectFiles->setWhatsThis(i18n("<b>Show non project files</b><p>Shows files that do not belong to a project in a file tree.")); m_actionToggleDisplayLocation = new KToggleAction( i18n("Display Location Column"), KShortcut(), - this, SLOT(slotToggleDisplayLocation()), this, "actiontoggleshowlocation" ); + this, TQT_SLOT(slotToggleDisplayLocation()), this, "actiontoggleshowlocation" ); m_actionToggleDisplayLocation->setWhatsThis(i18n("<b>Display the Location Column</b><p>Displays a column with the location of the files.")); m_part = part; (void) translations; // supress compiler warning - QDomDocument &dom = *m_part->projectDom(); + TQDomDocument &dom = *m_part->projectDom(); m_actionToggleShowNonProjectFiles->setChecked( !DomUtil::readBoolEntry(dom, "/kdevfileview/groups/hidenonprojectfiles") ); m_actionToggleDisplayLocation->setChecked( !DomUtil::readBoolEntry(dom, "/kdevfileview/groups/hidenonlocation") ); } @@ -198,13 +198,13 @@ FileGroupsWidget::FileGroupsWidget(FileGroupsPart *part) FileGroupsWidget::~FileGroupsWidget() { - QDomDocument &dom = *m_part->projectDom(); + TQDomDocument &dom = *m_part->projectDom(); DomUtil::writeBoolEntry( dom, "/kdevfileview/groups/hidenonprojectfiles", !m_actionToggleShowNonProjectFiles->isChecked() ); DomUtil::writeBoolEntry( dom, "/kdevfileview/groups/hidenonlocation", !m_actionToggleDisplayLocation->isChecked() ); } -void FileGroupsWidget::slotItemExecuted(QListViewItem *item) +void FileGroupsWidget::slotItemExecuted(TQListViewItem *item) { if (!item) return; @@ -222,7 +222,7 @@ void FileGroupsWidget::slotItemExecuted(QListViewItem *item) } -void FileGroupsWidget::slotContextMenu(KListView *, QListViewItem *item, const QPoint &p) +void FileGroupsWidget::slotContextMenu(KListView *, TQListViewItem *item, const TQPoint &p) { KPopupMenu popup(i18n("File Groups"), this); /// @todo Add, remove groups @@ -232,15 +232,15 @@ void FileGroupsWidget::slotContextMenu(KListView *, QListViewItem *item, const Q if (item->parent()) { // Not for group items FileGroupsFileItem *fvfitem = static_cast<FileGroupsFileItem*>(item); - QString pathName = m_part->project()->projectDirectory() + QDir::separator() + fvfitem->fileName(); + TQString pathName = m_part->project()->projectDirectory() + TQDir::separator() + fvfitem->fileName(); KURL::List urls; urls.append(pathName); FileContext context(urls); m_part->core()->fillContextMenu(&popup, &context); } else{ - QStringList file_list; - QListViewItem* i = item->firstChild(); + TQStringList file_list; + TQListViewItem* i = item->firstChild(); while(i){ FileGroupsFileItem *fvgitem = static_cast<FileGroupsFileItem*>(i); file_list << fvgitem->fileName(); @@ -258,21 +258,21 @@ void FileGroupsWidget::slotContextMenu(KListView *, QListViewItem *item, const Q KDialogBase dlg(KDialogBase::TreeList, i18n("Customize File Groups"), KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, this, "customization dialog"); - QVBox *vbox = dlg.addVBoxPage(i18n("File Groups")); + TQVBox *vbox = dlg.addVBoxPage(i18n("File Groups")); FileGroupsConfigWidget *w = new FileGroupsConfigWidget(m_part, vbox, "file groups config widget"); - connect(&dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(&dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept())); dlg.exec(); } } -QStringList FileGroupsWidget::allFilesRecursively( QString const & dir ) +TQStringList FileGroupsWidget::allFilesRecursively( TQString const & dir ) { - QStringList filelist; - QString reldir = dir.mid( m_part->project()->projectDirectory().length() +1 ); + TQStringList filelist; + TQString reldir = dir.mid( m_part->project()->projectDirectory().length() +1 ); // recursively fetch all files in subdirectories - QStringList subdirs = QDir( dir ).entryList( QDir::Dirs ); - QValueListIterator<QString> it = subdirs.begin(); + TQStringList subdirs = TQDir( dir ).entryList( TQDir::Dirs ); + TQValueListIterator<TQString> it = subdirs.begin(); while ( it != subdirs.end() ) { if ( *it != "." && *it != ".." ) @@ -283,8 +283,8 @@ QStringList FileGroupsWidget::allFilesRecursively( QString const & dir ) } // append the project relative directory path to all files in the current directory - QStringList dirlist = QDir( dir ).entryList( QDir::Files ); - QValueListIterator<QString> itt = dirlist.begin(); + TQStringList dirlist = TQDir( dir ).entryList( TQDir::Files ); + TQValueListIterator<TQString> itt = dirlist.begin(); while ( itt != dirlist.end() ) { if ( reldir.isEmpty() ) @@ -316,7 +316,7 @@ void FileGroupsWidget::refresh() if (LocationID!=-1) removeColumn(LocationID); } - QDomDocument &dom = *m_part->projectDom(); + TQDomDocument &dom = *m_part->projectDom(); DomUtil::PairList list = DomUtil::readPairListEntry(dom, "/kdevfileview/groups", "group", "name", "pattern"); @@ -330,7 +330,7 @@ void FileGroupsWidget::refresh() lastGroup = newItem; } - QStringList allFiles; + TQStringList allFiles; if (m_actionToggleShowNonProjectFiles->isChecked()) { // get all files in the project directory allFiles = allFilesRecursively( m_part->project()->projectDirectory() ); @@ -339,9 +339,9 @@ void FileGroupsWidget::refresh() // get all project files allFiles = m_part->project()->allFiles(); } - QStringList::ConstIterator fit; + TQStringList::ConstIterator fit; for (fit = allFiles.begin(); fit != allFiles.end(); ++fit) { - QListViewItem *item = firstChild(); + TQListViewItem *item = firstChild(); while (item) { FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item); if (fvgitem->matches(*fit)) { @@ -352,7 +352,7 @@ void FileGroupsWidget::refresh() } } - QListViewItem *item = firstChild(); + TQListViewItem *item = firstChild(); while (item) { item->sortChildItems(0, true); item = item->nextSibling(); @@ -360,16 +360,16 @@ void FileGroupsWidget::refresh() } -void FileGroupsWidget::addFile(const QString &fileName) +void FileGroupsWidget::addFile(const TQString &fileName) { kdDebug(9017) << "FileView add " << fileName << endl; - QListViewItem *item = firstChild(); + TQListViewItem *item = firstChild(); while (item) { FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item); if (fvgitem->matches(fileName)) { - QString f = fileName; + TQString f = fileName; if (fileName.contains(m_part->project()->projectDirectory())) f = fileName.mid(m_part->project()->projectDirectory().length()+1); (void) new FileGroupsFileItem(fvgitem, f); @@ -380,9 +380,9 @@ void FileGroupsWidget::addFile(const QString &fileName) } } -void FileGroupsWidget::addFiles ( const QStringList& fileList ) +void FileGroupsWidget::addFiles ( const TQStringList& fileList ) { - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it = fileList.begin(); it != fileList.end(); ++it ) { @@ -391,15 +391,15 @@ void FileGroupsWidget::addFiles ( const QStringList& fileList ) sort(); } -void FileGroupsWidget::removeFile(const QString &fileName) +void FileGroupsWidget::removeFile(const TQString &fileName) { kdDebug(9017) << "FileView remove " << fileName << endl; - QListViewItem *item = firstChild(); + TQListViewItem *item = firstChild(); while (item) { FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item); - QListViewItem *childItem = fvgitem->firstChild(); + TQListViewItem *childItem = fvgitem->firstChild(); while (childItem) { FileGroupsFileItem *fgfitem = static_cast<FileGroupsFileItem*>(childItem); @@ -417,9 +417,9 @@ void FileGroupsWidget::removeFile(const QString &fileName) } } -void FileGroupsWidget::removeFiles ( const QStringList& fileList ) +void FileGroupsWidget::removeFiles ( const TQStringList& fileList ) { - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it = fileList.begin(); it != fileList.end(); ++it ) { |