@ -70,32 +70,36 @@
// ----------------------------------------------------------------------
KAppTreeListItem : : KAppTreeListItem ( TDEListView * parent , const TQString & name ,
const TQPixmap & pixmap , bool parse , bool dir , const TQString & p , const TQString & c )
const TQPixmap & pixmap , bool parse , bool dir ,
const TQString & p , const TQString & c , const TQString & dp )
: TQListViewItem ( parent , name )
{
init ( pixmap , parse , dir , p , c );
init ( pixmap , parse , dir , p , c , dp );
}
// ----------------------------------------------------------------------
KAppTreeListItem : : KAppTreeListItem ( TQListViewItem * parent , const TQString & name ,
const TQPixmap & pixmap , bool parse , bool dir , const TQString & p , const TQString & c )
const TQPixmap & pixmap , bool parse , bool dir ,
const TQString & p , const TQString & c , const TQString & dp )
: TQListViewItem ( parent , name )
{
init ( pixmap , parse , dir , p , c );
init ( pixmap , parse , dir , p , c , dp );
}
// ----------------------------------------------------------------------
void KAppTreeListItem : : init ( const TQPixmap & pixmap , bool parse , bool dir , const TQString & _path , const TQString & _exec )
void KAppTreeListItem : : init ( const TQPixmap & pixmap , bool parse , bool dir ,
const TQString & _path , const TQString & _exec , const TQString & _desktopPath )
{
setPixmap ( 0 , pixmap ) ;
parsed = parse ;
directory = dir ;
path = _path ; // relative path
exec = _exec ;
exec = _exec ; // executable command
desktopPath = _desktopPath ; // .desktop file path
}
@ -193,10 +197,7 @@ void TDEApplicationTree::addDesktopGroup( const TQString &relPath, KAppTreeListI
for ( KServiceGroup : : List : : ConstIterator it = list . begin ( ) ;
it ! = list . end ( ) ; it + + )
{
TQString icon ;
TQString text ;
TQString relPath ;
TQString exec ;
TQString icon , text , relPath , exec , desktopPath ;
bool isDir = false ;
KSycocaEntry * p = ( * it ) ;
if ( p - > isType ( KST_KService ) )
@ -209,6 +210,7 @@ void TDEApplicationTree::addDesktopGroup( const TQString &relPath, KAppTreeListI
icon = service - > icon ( ) ;
text = service - > name ( ) ;
exec = service - > exec ( ) ;
desktopPath = service - > desktopEntryPath ( ) ;
}
else if ( p - > isType ( KST_KServiceGroup ) )
{
@ -229,13 +231,13 @@ void TDEApplicationTree::addDesktopGroup( const TQString &relPath, KAppTreeListI
}
TQPixmap pixmap = appIcon ( icon ) ;
if ( item )
newItem = new KAppTreeListItem ( item , text , pixmap , false , isDir ,
relPath , exec ) ;
relPath , exec , desktopPath ) ;
else
newItem = new KAppTreeListItem ( this , text , pixmap , false , isDir ,
relPath , exec ) ;
relPath , exec , desktopPath ) ;
if ( isDir )
newItem - > setExpandable ( true ) ;
}
@ -255,7 +257,7 @@ void TDEApplicationTree::slotItemHighlighted(TQListViewItem* i)
currentitem = item ;
if ( ( ! item - > directory ) & & ( ! item - > exec . isEmpty ( ) ) )
emit highlighted ( item - > text ( 0 ) , item - > exec ) ;
emit highlighted ( item - > text ( 0 ) , item - > exec , item - > desktopPath ) ;
}
@ -272,7 +274,7 @@ void TDEApplicationTree::slotSelectionChanged(TQListViewItem* i)
currentitem = item ;
if ( ( ! item - > directory ) & & ( ! item - > exec . isEmpty ( ) ) )
emit selected ( item - > text ( 0 ) , item - > exec ) ;
emit selected ( item - > text ( 0 ) , item - > exec , item - > desktopPath ) ;
}
// ----------------------------------------------------------------------
@ -350,7 +352,7 @@ KOpenWithDlg::KOpenWithDlg( const TQString &serviceType, const TQString& value,
TQWidget * parent )
: TQDialog ( parent , " openwith " , true )
{
setCaption ( i18n ( " Choose Application for %1 " ) . arg ( serviceType ) ) ;
setCaption ( i18n ( " Choose Application for %1 " ) . arg ( serviceType ) ) ;
TQString text = i18n ( " <qt>Select the program for the file type: <b>%1</b>. "
" If the program is not listed, enter the name or click "
" the browse button.</qt> " ) . arg ( serviceType ) ;
@ -459,10 +461,10 @@ void KOpenWithDlg::init( const TQString& _text, const TQString& _value )
m_pTree = new TDEApplicationTree ( this ) ;
topLayout - > addWidget ( m_pTree ) ;
connect ( m_pTree , TQT_SIGNAL ( selected ( const TQString & , const TQString & ) ) ,
TQT_SLOT ( slotSelected ( const TQString & , const TQString & ) ) ) ;
connect ( m_pTree , TQT_SIGNAL ( highlighted ( const TQString & , const TQString & ) ) ,
TQT_SLOT ( slotHighlighted ( const TQString & , const TQString & ) ) ) ;
connect ( m_pTree , TQT_SIGNAL ( selected ( const TQString & , const TQString & , const TQString & ) ) ,
TQT_SLOT ( slotSelected ( const TQString & , const TQString & , const TQString & ) ) ) ;
connect ( m_pTree , TQT_SIGNAL ( highlighted ( const TQString & , const TQString & , const TQString & ) ) ,
TQT_SLOT ( slotHighlighted ( const TQString & , const TQString & , const TQString & ) ) ) ;
connect ( m_pTree , TQT_SIGNAL ( doubleClicked ( TQListViewItem * ) ) ,
TQT_SLOT ( slotDbClick ( ) ) ) ;
@ -543,7 +545,7 @@ void KOpenWithDlg::slotClear()
// ----------------------------------------------------------------------
void KOpenWithDlg : : slotSelected ( const TQString & /*_name*/ , const TQString & _exec )
void KOpenWithDlg : : slotSelected ( const TQString & /*_name*/ , const TQString & _exec , const TQString & /*_desktopPath*/ )
{
kdDebug ( 250 ) < < " KOpenWithDlg::slotSelected " < < endl ;
KService : : Ptr pService = d - > curService ;
@ -554,11 +556,18 @@ void KOpenWithDlg::slotSelected( const TQString& /*_name*/, const TQString& _exe
// ----------------------------------------------------------------------
void KOpenWithDlg : : slotHighlighted ( const TQString & _name , const TQString & )
void KOpenWithDlg : : slotHighlighted ( const TQString & _name , const TQString & _exec , const TQString & _desktopPath )
{
kdDebug ( 250 ) < < " KOpenWithDlg::slotHighlighted " < < endl ;
qName = _name ;
d - > curService = KService : : serviceByName ( qName ) ;
// Look up by desktop path first, to avoid returning wrong results in case multiple .desktop files
// contain the same name for different services (such as Konsole)
// Try by name only if first search fails (this should never happen normally)
d - > curService = KService : : serviceByDesktopPath ( _desktopPath )
if ( ! d - > curService )
{
d - > curService = KService : : serviceByName ( qName ) ;
}
if ( ! m_terminaldirty )
{
// ### indicate that default value was restored