diff options
Diffstat (limited to 'kate/app/katefilelist.cpp')
-rw-r--r-- | kate/app/katefilelist.cpp | 69 |
1 files changed, 39 insertions, 30 deletions
diff --git a/kate/app/katefilelist.cpp b/kate/app/katefilelist.cpp index 9dd958a5d..de749a60a 100644 --- a/kate/app/katefilelist.cpp +++ b/kate/app/katefilelist.cpp @@ -48,6 +48,7 @@ #include <kstringhandler.h> #include <kcolorbutton.h> #include <kdialog.h> +#include <kmimetype.h> //END Includes //BEGIN ToolTip @@ -94,7 +95,7 @@ KateFileList::KateFileList (KateMainWindow *main, m_editShade = TQColor( 255, 102, 153 ); m_enableBgShading = false; - setFocusPolicy ( TQ_NoFocus ); + setFocusPolicy ( TQWidget::NoFocus ); viewManager = _viewManager; @@ -107,7 +108,7 @@ KateFileList::KateFileList (KateMainWindow *main, setupActions (); - connect(this,TQT_SIGNAL(moved()),this,TQT_SLOT(updateFileListLocations())); + connect(this,TQ_SIGNAL(moved()),this,TQ_SLOT(updateFileListLocations())); for (uint i = 0; i < KateDocManager::self()->documents(); i++) { @@ -115,18 +116,18 @@ KateFileList::KateFileList (KateMainWindow *main, slotModChanged (KateDocManager::self()->document(i)); } - connect(KateDocManager::self(),TQT_SIGNAL(documentCreated(Kate::Document *)), - this,TQT_SLOT(slotDocumentCreated(Kate::Document *))); - connect(KateDocManager::self(),TQT_SIGNAL(documentDeleted(uint)), - this,TQT_SLOT(slotDocumentDeleted(uint))); + connect(KateDocManager::self(),TQ_SIGNAL(documentCreated(Kate::Document *)), + this,TQ_SLOT(slotDocumentCreated(Kate::Document *))); + connect(KateDocManager::self(),TQ_SIGNAL(documentDeleted(uint)), + this,TQ_SLOT(slotDocumentDeleted(uint))); // don't Honour KDE single/double click setting, this files are already open, // no need for hassle of considering double-click - connect(this,TQT_SIGNAL(selectionChanged(TQListViewItem *)), - this,TQT_SLOT(slotActivateView(TQListViewItem *))); - connect(viewManager,TQT_SIGNAL(viewChanged()), this,TQT_SLOT(slotViewChanged())); - connect(this,TQT_SIGNAL(contextMenuRequested( TQListViewItem *, const TQPoint &, int )), - this,TQT_SLOT(slotMenu ( TQListViewItem *, const TQPoint &, int ))); + connect(this,TQ_SIGNAL(selectionChanged(TQListViewItem *)), + this,TQ_SLOT(slotActivateView(TQListViewItem *))); + connect(viewManager,TQ_SIGNAL(viewChanged()), this,TQ_SLOT(slotViewChanged())); + connect(this,TQ_SIGNAL(contextMenuRequested( TQListViewItem *, const TQPoint &, int )), + this,TQ_SLOT(slotMenu ( TQListViewItem *, const TQPoint &, int ))); } KateFileList::~KateFileList () @@ -136,20 +137,20 @@ KateFileList::~KateFileList () void KateFileList::setupActions () { - windowNext = KStdAction::back(TQT_TQOBJECT(this), TQT_SLOT(slotPrevDocument()), m_main->actionCollection()); - windowPrev = KStdAction::forward(TQT_TQOBJECT(this), TQT_SLOT(slotNextDocument()), m_main->actionCollection()); + windowNext = KStdAction::back(this, TQ_SLOT(slotPrevDocument()), m_main->actionCollection()); + windowPrev = KStdAction::forward(this, TQ_SLOT(slotNextDocument()), m_main->actionCollection()); sortAction = new TDESelectAction( i18n("Sort &By"), 0, m_main->actionCollection(), "filelist_sortby" ); listMoveFileUp = new TDEAction( i18n("Move File Up"), 0, m_main->actionCollection(), "filelist_move_up" ); //listMoveFileUp->setShortcut(TDEShortcut(CTRL + SHIFT + Key_Comma)); listMoveFileDown = new TDEAction( i18n("Move File Down"), 0, m_main->actionCollection(), "filelist_move_down" ); //listMoveFileDown->setShortcut(TDEShortcut(CTRL + SHIFT + Key_Period)); - connect( listMoveFileUp, TQT_SIGNAL(activated()), TQT_TQOBJECT(this), TQT_SLOT(moveFileUp()) ); - connect( listMoveFileDown, TQT_SIGNAL(activated()), TQT_TQOBJECT(this), TQT_SLOT(moveFileDown()) ); + connect( listMoveFileUp, TQ_SIGNAL(activated()), this, TQ_SLOT(moveFileUp()) ); + connect( listMoveFileDown, TQ_SIGNAL(activated()), this, TQ_SLOT(moveFileDown()) ); TQStringList l; l << i18n("Opening Order") << i18n("Document Name") << i18n("URL") << i18n("Manual Placement"); sortAction->setItems( l ); - connect( sortAction, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(this), TQT_SLOT(setSortType(int)) ); + connect( sortAction, TQ_SIGNAL(activated(int)), this, TQ_SLOT(setSortType(int)) ); } void KateFileList::updateActions () @@ -176,6 +177,7 @@ void KateFileList::keyPressEvent(TQKeyEvent *e) { // returning void KateFileList::contentsMousePressEvent( TQMouseEvent *e ) { + if (e->button() != TQMouseEvent::LeftButton) return; m_lastMouseDownPos = e->pos(); if ( ! itemAt( contentsToViewport( e->pos() ) ) ) @@ -227,9 +229,9 @@ void KateFileList::slotPrevDocument() void KateFileList::slotDocumentCreated (Kate::Document *doc) { new KateFileListItem( this, doc/*, doc->documentNumber()*/ ); - connect(doc,TQT_SIGNAL(modStateChanged(Kate::Document *)),this,TQT_SLOT(slotModChanged(Kate::Document *))); - connect(doc,TQT_SIGNAL(nameChanged(Kate::Document *)),this,TQT_SLOT(slotNameChanged(Kate::Document *))); - connect(doc,TQT_SIGNAL(modifiedOnDisc(Kate::Document *, bool, unsigned char)),this,TQT_SLOT(slotModifiedOnDisc(Kate::Document *, bool, unsigned char))); + connect(doc,TQ_SIGNAL(modStateChanged(Kate::Document *)),this,TQ_SLOT(slotModChanged(Kate::Document *))); + connect(doc,TQ_SIGNAL(nameChanged(Kate::Document *)),this,TQ_SLOT(slotNameChanged(Kate::Document *))); + connect(doc,TQ_SIGNAL(modifiedOnDisc(Kate::Document *, bool, unsigned char)),this,TQ_SLOT(slotModifiedOnDisc(Kate::Document *, bool, unsigned char))); sort(); updateFileListLocations(); @@ -267,7 +269,7 @@ void KateFileList::slotActivateView( TQListViewItem *item ) if (info && info->modifiedOnDisc) { // Simulate mouse button release, otherwise the paused DND operation // will reactivate as soon as the mouse re-enters the list view! - TQMouseEvent e(TQEvent::MouseButtonRelease, m_lastMouseDownPos, Qt::LeftButton, 0); + TQMouseEvent e(TQEvent::MouseButtonRelease, m_lastMouseDownPos, TQt::LeftButton, 0); contentsMouseReleaseEvent(&e); } @@ -436,7 +438,7 @@ TQString KateFileList::tooltip( TQListViewItem *item, int ) str += i18n("<b>This file was changed (deleted) on disk by another program.</b><br />"); } - str += i->document()->url().prettyURL(); + str += i->document()->url().pathOrURL(); return str; } @@ -556,20 +558,27 @@ KateFileListItem::~KateFileListItem() { } + const TQPixmap *KateFileListItem::pixmap ( int column ) const { if ( column == 0) { - static TQPixmap noPm = SmallIcon ("null"); + static TQMap<TQString, TQPixmap> mimeIcons; static TQPixmap modPm = SmallIcon("modified"); static TQPixmap discPm = SmallIcon("modonhd"); static TQPixmap modmodPm = SmallIcon("modmod"); const KateDocumentInfo *info = KateDocManager::self()->documentInfo(doc); + KMimeType::Ptr mime = KMimeType::findByURL(doc->url()); + + if (!mimeIcons.contains(mime->name())) + { + mimeIcons.insert(mime->name(), mime->pixmap(TDEIcon::Small)); + } if (info && info->modifiedOnDisc) return doc->isModified() ? &modmodPm : &discPm; else - return doc->isModified() ? &modPm : &noPm; + return doc->isModified() ? &modPm : &mimeIcons[mime->name()]; } return 0; @@ -659,7 +668,7 @@ KFLConfigPage::KFLConfigPage( TQWidget* parent, const char *name, KateFileList * int spacing = KDialog::spacingHint(); lo1->setSpacing( spacing ); - TQGroupBox *gb = new TQGroupBox( 1, Qt::Horizontal, i18n("Background Shading"), this ); + TQGroupBox *gb = new TQGroupBox( 1, TQt::Horizontal, i18n("Background Shading"), this ); lo1->addWidget( gb ); TQWidget *g = new TQWidget( gb ); @@ -707,11 +716,11 @@ KFLConfigPage::KFLConfigPage( TQWidget* parent, const char *name, KateFileList * reload(); slotEnableChanged(); - connect( cbEnableShading, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotMyChanged()) ); - connect( cbEnableShading, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnableChanged()) ); - connect( kcbViewShade, TQT_SIGNAL(changed(const TQColor&)), this, TQT_SLOT(slotMyChanged()) ); - connect( kcbEditShade, TQT_SIGNAL(changed(const TQColor&)), this, TQT_SLOT(slotMyChanged()) ); - connect( cmbSort, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMyChanged()) ); + connect( cbEnableShading, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotMyChanged()) ); + connect( cbEnableShading, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotEnableChanged()) ); + connect( kcbViewShade, TQ_SIGNAL(changed(const TQColor&)), this, TQ_SLOT(slotMyChanged()) ); + connect( kcbEditShade, TQ_SIGNAL(changed(const TQColor&)), this, TQ_SLOT(slotMyChanged()) ); + connect( cmbSort, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotMyChanged()) ); } void KFLConfigPage::apply() @@ -732,7 +741,7 @@ void KFLConfigPage::apply() void KFLConfigPage::reload() { // read in from config file - TDEConfig *config = kapp->config(); + TDEConfig *config = tdeApp->config(); config->setGroup( "Filelist" ); cbEnableShading->setChecked( config->readBoolEntry("Shading Enabled", &m_filelist->m_enableBgShading ) ); kcbViewShade->setColor( config->readColorEntry("View Shade", &m_filelist->m_viewShade ) ); |