2
2
smb4ksharesiconviewitem - The items for Smb4K's shares icon view.
4
4
begin : Di Dez 5 2006
5
copyright : (C) 2006-2008 by Alexander Reinholdt
6
email : dustpuppy@users.berlios.de
5
copyright : (C) 2006-2010 by Alexander Reinholdt
6
email : alexander.reinholdt@kdemail.net
7
7
***************************************************************************/
9
9
/***************************************************************************
35
35
#include <smb4ksharesiconviewitem.h>
36
36
#include <smb4ksharesiconview.h>
38
Smb4KSharesIconViewItem::Smb4KSharesIconViewItem( Smb4KShare *share, Smb4KSharesIconView *parent )
39
: QListWidgetItem( parent )
38
Smb4KSharesIconViewItem::Smb4KSharesIconViewItem( Smb4KSharesIconView *parent, Smb4KShare *share, bool mountpoint )
39
: QListWidgetItem( parent ), m_share( *share ), m_mountpoint( mountpoint )
41
41
setFlags( flags() | Qt::ItemIsDropEnabled );
43
m_data.setShare( share );
45
setText( m_share.unc() );
49
setText( m_share.path() );
45
setupItem( m_data.share(), m_data.showMountPoint() );
52
setIcon( m_share.icon() );
55
void Smb4KSharesIconViewItem::setupItem( Smb4KShare *share, bool mountpoint )
61
overlays.append( "emblem-mounted" );
63
if ( m_data.share()->isInaccessible() )
65
icon = KIcon( "folder-locked", KIconLoader::global(), overlays );
69
icon = KIcon( "folder-remote", KIconLoader::global(), overlays );
72
if ( m_data.share()->isForeign() )
74
m_data.setIcon( icon, QIcon::Disabled );
78
m_data.setIcon( icon );
81
setIcon( KIcon( m_data.pixmap( KIconLoader::SizeMedium ) ) );
84
setText( (mountpoint ? m_data.share()->path() : m_data.share()->unc()) );
86
m_data.setShare( share );
87
m_data.setShowMountPoint( mountpoint );
91
62
void Smb4KSharesIconViewItem::setShowMountPoint( bool show )
93
setupItem( m_data.share(), show );
97
bool Smb4KSharesIconViewItem::sameShareObject( Smb4KShare *share )
99
return m_data.share()->equals( *share, Smb4KShare::LocalOnly );
103
void Smb4KSharesIconViewItem::replaceShareObject( Smb4KShare *share )
105
setupItem( share, m_data.showMountPoint() );
69
void Smb4KSharesIconViewItem::update( Smb4KShare *share )
75
setText( m_share.unc() );
79
setText( m_share.path() );
82
setIcon( m_share.icon() );