Fix a number of issues related to the media kioslave

pull/2/head
Timothy Pearson 11 years ago
parent dbe6ecbb72
commit 6342dc3990

@ -177,6 +177,8 @@ AuthReturn Authenticate(const char *caller, const char *method,
case PAM_MAXTRIES: /* should handle this better ... */ case PAM_MAXTRIES: /* should handle this better ... */
case PAM_AUTHINFO_UNAVAIL: /* returned for unknown users ... bogus */ case PAM_AUTHINFO_UNAVAIL: /* returned for unknown users ... bogus */
return AuthBad; return AuthBad;
case PAM_SERVICE_ERR:
return AuthError;
default: default:
return AuthError; return AuthError;
} }

@ -370,7 +370,15 @@
<cstring>enableMediaBox</cstring> <cstring>enableMediaBox</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Show device icons:</string> <string>&amp;Show device icons</string>
</property>
</widget>
<widget class="TQCheckBox">
<property name="name">
<cstring>enableMediaFreeSpaceOverlayBox</cstring>
</property>
<property name="text">
<string>&amp;Show free space overlay on device icons</string>
</property> </property>
</widget> </widget>
<widget class="TDEListView"> <widget class="TDEListView">

@ -220,6 +220,7 @@ DesktopBehavior::DesktopBehavior(TDEConfig *config, TQWidget *parent, const char
if (m_bHasMedia) if (m_bHasMedia)
{ {
connect(enableMediaBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged())); connect(enableMediaBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged()));
connect(enableMediaFreeSpaceOverlayBox, TQT_SIGNAL(clicked()), this, TQT_SLOT(enableChanged()));
} }
else else
{ {
@ -255,6 +256,7 @@ void DesktopBehavior::fillMediaListView()
TQValueListIterator<KMimeType::Ptr> it2(mimetypes.begin()); TQValueListIterator<KMimeType::Ptr> it2(mimetypes.begin());
g_pConfig->setGroup( "Media" ); g_pConfig->setGroup( "Media" );
enableMediaBox->setChecked(g_pConfig->readBoolEntry("enabled",false)); enableMediaBox->setChecked(g_pConfig->readBoolEntry("enabled",false));
enableMediaFreeSpaceOverlayBox->setChecked(g_pConfig->readBoolEntry("FreeSpaceDisplayEnabled",true));
TQString excludedMedia=g_pConfig->readEntry("exclude","media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted"); TQString excludedMedia=g_pConfig->readEntry("exclude","media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted");
for (; it2 != mimetypes.end(); ++it2) { for (; it2 != mimetypes.end(); ++it2) {
if ( ((*it2)->name().startsWith("media/")) ) if ( ((*it2)->name().startsWith("media/")) )
@ -272,6 +274,7 @@ void DesktopBehavior::saveMediaListView()
g_pConfig->setGroup( "Media" ); g_pConfig->setGroup( "Media" );
g_pConfig->writeEntry("enabled",enableMediaBox->isChecked()); g_pConfig->writeEntry("enabled",enableMediaBox->isChecked());
g_pConfig->writeEntry("FreeSpaceDisplayEnabled",enableMediaFreeSpaceOverlayBox->isChecked());
TQStringList exclude; TQStringList exclude;
for (DesktopBehaviorMediaItem *it=static_cast<DesktopBehaviorMediaItem *>(mediaListView->firstChild()); for (DesktopBehaviorMediaItem *it=static_cast<DesktopBehaviorMediaItem *>(mediaListView->firstChild());
it; it=static_cast<DesktopBehaviorMediaItem *>(it->nextSibling())) it; it=static_cast<DesktopBehaviorMediaItem *>(it->nextSibling()))
@ -423,6 +426,7 @@ void DesktopBehavior::enableChanged()
{ {
behaviorTab->setTabEnabled(behaviorTab->page(2), enabled); behaviorTab->setTabEnabled(behaviorTab->page(2), enabled);
enableMediaBox->setEnabled(enabled); enableMediaBox->setEnabled(enabled);
enableMediaFreeSpaceOverlayBox->setEnabled(enabled);
setMediaListViewEnabled(enableMediaBox->isChecked()); setMediaListViewEnabled(enableMediaBox->isChecked());
} }

@ -209,6 +209,11 @@
<!-- kdiconview.cc:261 --> <!-- kdiconview.cc:261 -->
<!-- TQString tmpList=config->readEntry("exclude","media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted"); --> <!-- TQString tmpList=config->readEntry("exclude","media/hdd_mounted,media/hdd_unmounted,media/floppy_unmounted,media/cdrom_unmounted,media/floppy5_unmounted"); -->
</entry> </entry>
<entry name="MediaFreeSpaceDisplayEnabled" key="FreeSpaceDisplayEnabled" type="Bool">
<default>true</default>
<label></label>
<whatsthis></whatsthis>
</entry>
</group> </group>
<group name="KDE"> <group name="KDE">
<entry key="macStyle" type="Bool"> <entry key="macStyle" type="Bool">

@ -39,6 +39,7 @@
#include <konq_popupmenu.h> #include <konq_popupmenu.h>
#include <konq_settings.h> #include <konq_settings.h>
#include <konq_undo.h> #include <konq_undo.h>
#include <kivfreespaceoverlay.h>
#include <kprotocolinfo.h> #include <kprotocolinfo.h>
#include <kstdaction.h> #include <kstdaction.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
@ -148,7 +149,8 @@ KDIconView::KDIconView( TQWidget *parent, const char* name )
m_bSortDirectoriesFirst( true ), m_bSortDirectoriesFirst( true ),
m_itemsAlwaysFirst(), m_itemsAlwaysFirst(),
m_gotIconsArea(false), m_gotIconsArea(false),
m_needDesktopAlign(true) m_needDesktopAlign(true),
m_paOutstandingOverlaysTimer( 0L )
{ {
setResizeMode( Fixed ); setResizeMode( Fixed );
setIconArea( desktopRect() ); // the default is the whole desktop setIconArea( desktopRect() ); // the default is the whole desktop
@ -159,8 +161,7 @@ KDIconView::KDIconView( TQWidget *parent, const char* name )
// Initialize media handler // Initialize media handler
mMediaListView = new TQListView(); mMediaListView = new TQListView();
connect( TQApplication::clipboard(), TQT_SIGNAL(dataChanged()), connect( TQApplication::clipboard(), TQT_SIGNAL(dataChanged()), this, TQT_SLOT(slotClipboardDataChanged()) );
this, TQT_SLOT(slotClipboardDataChanged()) );
setURL( desktopURL() ); // sets m_url setURL( desktopURL() ); // sets m_url
@ -298,10 +299,12 @@ void KDIconView::initConfig( bool init )
m_bSortDirectoriesFirst = KDesktopSettings::directoriesFirst(); m_bSortDirectoriesFirst = KDesktopSettings::directoriesFirst();
m_itemsAlwaysFirst = KDesktopSettings::alwaysFirstItems(); // Distributor plug-in m_itemsAlwaysFirst = KDesktopSettings::alwaysFirstItems(); // Distributor plug-in
if (KProtocolInfo::isKnownProtocol(TQString::fromLatin1("media"))) if (KProtocolInfo::isKnownProtocol(TQString::fromLatin1("media"))) {
m_enableMedia=KDesktopSettings::mediaEnabled(); m_enableMedia=KDesktopSettings::mediaEnabled();
else }
else {
m_enableMedia=false; m_enableMedia=false;
}
TQString tmpList=KDesktopSettings::exclude(); TQString tmpList=KDesktopSettings::exclude();
kdDebug(1204)<<"m_excludeList"<<tmpList<<endl; kdDebug(1204)<<"m_excludeList"<<tmpList<<endl;
m_excludedMedia=TQStringList::split(",",tmpList,false); m_excludedMedia=TQStringList::split(",",tmpList,false);
@ -312,6 +315,7 @@ void KDIconView::initConfig( bool init )
m_dirLister->setShowingDotFiles( m_bShowDot ); m_dirLister->setShowingDotFiles( m_bShowDot );
m_dirLister->emitChanges(); m_dirLister->emitChanges();
} }
slotFreeSpaceOverlaySettingChanged();
setArrangement(m_bVertAlign ? TopToBottom : LeftToRight); setArrangement(m_bVertAlign ? TopToBottom : LeftToRight);
@ -666,24 +670,27 @@ void KDIconView::slotMouseButtonPressed(int _button, TQIconViewItem* _item, cons
//kdDebug(1204) << "KDIconView::slotMouseButtonPressed" << endl; //kdDebug(1204) << "KDIconView::slotMouseButtonPressed" << endl;
if (!m_dirLister) return; if (!m_dirLister) return;
m_lastDeletedIconPos = TQPoint(); // user action -> not renaming an icon m_lastDeletedIconPos = TQPoint(); // user action -> not renaming an icon
if(!_item) if(!_item) {
KRootWm::self()->mousePressed( _global, _button ); KRootWm::self()->mousePressed( _global, _button );
}
} }
void KDIconView::slotMouseButtonClickedKDesktop(int _button, TQIconViewItem* _item, const TQPoint&) void KDIconView::slotMouseButtonClickedKDesktop(int _button, TQIconViewItem* _item, const TQPoint&)
{ {
if (!m_dirLister) return; if (!m_dirLister) return;
//kdDebug(1204) << "KDIconView::slotMouseButtonClickedKDesktop" << endl; //kdDebug(1204) << "KDIconView::slotMouseButtonClickedKDesktop" << endl;
if ( _item && _button == Qt::MidButton ) if ( _item && _button == Qt::MidButton ) {
slotExecuted(_item); slotExecuted(_item);
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void KDIconView::slotReturnPressed( TQIconViewItem *item ) void KDIconView::slotReturnPressed( TQIconViewItem *item )
{ {
if (item && item->isSelected()) if (item && item->isSelected()) {
slotExecuted(item); slotExecuted(item);
}
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -992,8 +999,9 @@ bool KDIconView::makeFriendlyText( KFileIVI *fileIVI )
u.addPath( ".directory" ); u.addPath( ".directory" );
// using TDEStandardDirs as this one checks for path being // using TDEStandardDirs as this one checks for path being
// a file instead of a directory // a file instead of a directory
if ( TDEStandardDirs::exists( u.path() ) ) if ( TDEStandardDirs::exists( u.path() ) ) {
desktopFile = u.path(); desktopFile = u.path();
}
} }
else if ( isDesktopFile( item ) ) else if ( isDesktopFile( item ) )
{ {
@ -1004,36 +1012,44 @@ bool KDIconView::makeFriendlyText( KFileIVI *fileIVI )
{ {
KSimpleConfig cfg( desktopFile, true ); KSimpleConfig cfg( desktopFile, true );
cfg.setDesktopGroup(); cfg.setDesktopGroup();
if (cfg.readBoolEntry("Hidden")) if (cfg.readBoolEntry("Hidden")) {
return false; return false;
}
if (cfg.readBoolEntry( "NoDisplay", false )) if (cfg.readBoolEntry( "NoDisplay", false )) {
return false; return false;
}
TQStringList tmpList; TQStringList tmpList;
if (cfg.hasKey("OnlyShowIn")) if (cfg.hasKey("OnlyShowIn"))
{ {
if (!cfg.readListEntry("OnlyShowIn", ';').contains("TDE")) if (!cfg.readListEntry("OnlyShowIn", ';').contains("TDE")) {
return false; return false;
}
} }
if (cfg.hasKey("NotShowIn")) if (cfg.hasKey("NotShowIn"))
{ {
if (cfg.readListEntry("NotShowIn", ';').contains("TDE")) if (cfg.readListEntry("NotShowIn", ';').contains("TDE")) {
return false; return false;
}
} }
if (cfg.hasKey("TryExec")) if (cfg.hasKey("TryExec"))
{ {
if (TDEStandardDirs::findExe( cfg.readEntry( "TryExec" ) ).isEmpty()) if (TDEStandardDirs::findExe( cfg.readEntry( "TryExec" ) ).isEmpty()) {
return false; return false;
}
} }
TQString name = cfg.readEntry("Name"); TQString name = cfg.readEntry("Name");
if ( !name.isEmpty() ) if ( !name.isEmpty() ) {
fileIVI->setText( name ); fileIVI->setText( name );
else }
else {
// For compatibility // For compatibility
fileIVI->setText( stripDesktopExtension( fileIVI->text() ) ); fileIVI->setText( stripDesktopExtension( fileIVI->text() ) );
}
} }
return true; return true;
} }
@ -1057,8 +1073,9 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
TQString desktopPath; TQString desktopPath;
KURL desktop_URL = desktopURL(); KURL desktop_URL = desktopURL();
if (desktop_URL.isLocalFile()) if (desktop_URL.isLocalFile()) {
desktopPath = desktop_URL.path(); desktopPath = desktop_URL.path();
}
// We have new items, so we'll need to repaint in slotCompleted // We have new items, so we'll need to repaint in slotCompleted
m_bNeedRepaint = true; m_bNeedRepaint = true;
kdDebug(1214) << "KDIconView::slotNewItems count=" << entries.count() << endl; kdDebug(1214) << "KDIconView::slotNewItems count=" << entries.count() << endl;
@ -1090,12 +1107,14 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
if (!desktopPath.isEmpty() && url.isLocalFile() && !url.path().startsWith(desktopPath)) if (!desktopPath.isEmpty() && url.isLocalFile() && !url.path().startsWith(desktopPath))
{ {
TQString fileName = url.fileName(); TQString fileName = url.fileName();
if (TQFile::exists(desktopPath + fileName)) if (TQFile::exists(desktopPath + fileName)) {
continue; // Don't duplicate entry continue; // Don't duplicate entry
}
TQString mostLocal = locate("appdata", "Desktop/"+fileName); TQString mostLocal = locate("appdata", "Desktop/"+fileName);
if (!mostLocal.isEmpty() && (mostLocal != url.path())) if (!mostLocal.isEmpty() && (mostLocal != url.path())) {
continue; // Don't duplicate entry continue; // Don't duplicate entry
}
} }
// No delayed mimetype determination on the desktop // No delayed mimetype determination on the desktop
@ -1197,6 +1216,11 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
newItemsList.append(fileIVI); newItemsList.append(fileIVI);
} }
} }
KFileItem* fileItem = fileIVI->item();
if ( fileItem->mimetype().startsWith("media/") && fileItem->mimetype().contains("_mounted") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
showFreeSpaceOverlay(fileIVI);
}
} }
KFileIVIList::iterator newitemit; KFileIVIList::iterator newitemit;
@ -1249,8 +1273,12 @@ void KDIconView::slotRefreshItems( const KFileItemList & entries )
} }
else else
fileIVI->refreshIcon( true ); fileIVI->refreshIcon( true );
if ( rit.current()->isMimeTypeKnown() ) if ( rit.current()->isMimeTypeKnown() ) {
fileIVI->setMouseOverAnimation( rit.current()->iconName() ); fileIVI->setMouseOverAnimation( rit.current()->iconName() );
}
if ( rit.current()->mimetype().startsWith("media/") && rit.current()->mimetype().contains("_mounted") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
showFreeSpaceOverlay(fileIVI);
}
break; break;
} }
} }
@ -1286,16 +1314,18 @@ void KDIconView::refreshIcons()
void KDIconView::FilesAdded( const KURL & directory ) void KDIconView::FilesAdded( const KURL & directory )
{ {
if ( directory.path().length() <= 1 && directory.protocol() == "trash" ) if ( directory.path().length() <= 1 && directory.protocol() == "trash" ) {
refreshTrashIcon(); refreshTrashIcon();
}
} }
void KDIconView::FilesRemoved( const KURL::List & fileList ) void KDIconView::FilesRemoved( const KURL::List & fileList )
{ {
if ( !fileList.isEmpty() ) { if ( !fileList.isEmpty() ) {
const KURL url = fileList.first(); const KURL url = fileList.first();
if ( url.protocol() == "trash" ) if ( url.protocol() == "trash" ) {
refreshTrashIcon(); refreshTrashIcon();
}
} }
} }
@ -1317,6 +1347,73 @@ void KDIconView::refreshTrashIcon()
} }
} }
void KDIconView::slotFreeSpaceOverlaySettingChanged()
{
bool show = KDesktopSettings::mediaFreeSpaceDisplayEnabled();
for ( TQIconViewItem *item = firstItem(); item; item = item->nextItem() )
{
KFileIVI* kItem = static_cast<KFileIVI*>(item);
if ( !kItem->item()->isDir() ) continue;
if (show) {
showFreeSpaceOverlay(kItem);
} else {
kItem -> setShowFreeSpaceOverlay(false);
}
}
updateContents();
}
void KDIconView::showFreeSpaceOverlay(KFileIVI* item)
{
KFileItem* fileItem = item->item();
if ( TDEGlobalSettings::showFilePreview( fileItem->url() ) ) {
m_paOutstandingOverlays.append(item);
if (m_paOutstandingOverlays.count() == 1)
{
if (!m_paOutstandingOverlaysTimer)
{
m_paOutstandingOverlaysTimer = new TQTimer(this);
connect(m_paOutstandingOverlaysTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotFreeSpaceOverlayStart()));
}
m_paOutstandingOverlaysTimer->start(20, true);
}
}
}
void KDIconView::slotFreeSpaceOverlayStart()
{
do
{
KFileIVI* item = m_paOutstandingOverlays.first();
if (!item) {
return; // Nothing to do
}
KIVFreeSpaceOverlay* overlay = item->setShowFreeSpaceOverlay( true );
if (overlay)
{
connect( overlay, TQT_SIGNAL( finished() ), this, TQT_SLOT( slotFreeSpaceOverlayFinished() ) );
overlay->start(); // Watch out, may emit finished() immediately!!
return; // Let it run....
}
m_paOutstandingOverlays.removeFirst();
} while (true);
}
void KDIconView::slotFreeSpaceOverlayFinished()
{
m_paOutstandingOverlays.removeFirst();
if (m_paOutstandingOverlays.count() > 0) {
m_paOutstandingOverlaysTimer->start(0, true); // Don't call directly to prevent deep recursion.
}
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void KDIconView::slotDeleteItem( KFileItem * _fileitem ) void KDIconView::slotDeleteItem( KFileItem * _fileitem )
@ -1332,8 +1429,9 @@ void KDIconView::slotDeleteItem( KFileItem * _fileitem )
TQString group = iconPositionGroupPrefix(); TQString group = iconPositionGroupPrefix();
group.append( fileIVI->item()->url().fileName() ); group.append( fileIVI->item()->url().fileName() );
if ( m_dotDirectory->hasGroup( group ) ) if ( m_dotDirectory->hasGroup( group ) ) {
m_dotDirectory->deleteGroup( group ); m_dotDirectory->deleteGroup( group );
}
m_lastDeletedIconPos = fileIVI->pos(); m_lastDeletedIconPos = fileIVI->pos();
delete fileIVI; delete fileIVI;

@ -20,6 +20,7 @@
#ifndef kdiconview_h #ifndef kdiconview_h
#define kdiconview_h #define kdiconview_h
#include <tqtimer.h>
#include <tqlistview.h> #include <tqlistview.h>
#include <konq_iconviewwidget.h> #include <konq_iconviewwidget.h>
@ -164,6 +165,10 @@ public slots:
void slotClear(); void slotClear();
void refreshIcons(); void refreshIcons();
protected slots:
void slotFreeSpaceOverlayStart();
void slotFreeSpaceOverlayFinished();
void slotFreeSpaceOverlaySettingChanged();
protected: protected:
void createActions(); void createActions();
@ -199,6 +204,8 @@ private:
static void saveIconPosition(KSimpleConfig *config, int x, int y); static void saveIconPosition(KSimpleConfig *config, int x, int y);
static void readIconPosition(KSimpleConfig *config, int &x, int &y); static void readIconPosition(KSimpleConfig *config, int &x, int &y);
void showFreeSpaceOverlay(KFileIVI* item);
/** Our action collection, parent of all our actions */ /** Our action collection, parent of all our actions */
TDEActionCollection m_actionCollection; TDEActionCollection m_actionCollection;
@ -270,6 +277,10 @@ private:
bool m_needDesktopAlign; bool m_needDesktopAlign;
TQListView *mMediaListView; TQListView *mMediaListView;
TQPtrList<KFileIVI> m_paOutstandingOverlays;
TQTimer *m_paOutstandingOverlaysTimer;
TDEConfig *g_pConfig; TDEConfig *g_pConfig;
}; };

@ -422,8 +422,8 @@ void PasswordDlg::reapVerify()
{ {
::close( sFd ); ::close( sFd );
int status; int status;
::waitpid( sPid, &status, 0 ); pid_t retpid = ::waitpid( sPid, &status, 0 );
if (WIFEXITED(status)) if (WIFEXITED(status)) {
switch (WEXITSTATUS(status)) { switch (WEXITSTATUS(status)) {
case AuthOk: case AuthOk:
greet->succeeded(); greet->succeeded();
@ -441,6 +441,11 @@ void PasswordDlg::reapVerify()
case AuthAbort: case AuthAbort:
return; return;
} }
}
else if (WIFSIGNALED(status)) {
// FIXME
// ERROR
}
cantCheck(); cantCheck();
} }

@ -115,6 +115,7 @@ void KFileIVIDesktop::paintItem( TQPainter *p, const TQColorGroup &cg)
p->restore(); p->restore();
paintOverlay(p); paintOverlay(p);
paintOverlayProgressBar(p);
} }
bool KFileIVIDesktop::shouldUpdateShadow(bool selected) bool KFileIVIDesktop::shouldUpdateShadow(bool selected)

@ -56,8 +56,8 @@ KButton::KButton( TQWidget* parent )
setButtonText(KickerSettings::kMenuText()); setButtonText(KickerSettings::kMenuText());
setFont(KickerSettings::buttonFont()); setFont(KickerSettings::buttonFont());
setTextColor(KickerSettings::buttonTextColor()); setTextColor(KickerSettings::buttonTextColor());
setMaximumHeight(30); setMaximumHeight(KickerSettings::maximumTDEMenuButtonHeight());
setMaximumWidth(widthForHeight(30)); setMaximumWidth(widthForHeight(KickerSettings::maximumTDEMenuButtonHeight()));
setCenterButtonInContainer(false); setCenterButtonInContainer(false);
} }
} }
@ -70,7 +70,7 @@ KButton::~KButton()
int KButton::widthForHeight(int height) const int KButton::widthForHeight(int height) const
{ {
if (KickerSettings::showKMenuText()) { if (KickerSettings::showKMenuText()) {
return PanelPopupButton::widthForHeight(30); return PanelPopupButton::widthForHeight((height>KickerSettings::maximumTDEMenuButtonHeight())?KickerSettings::maximumTDEMenuButtonHeight():height);
} }
else { else {
return PanelPopupButton::widthForHeight(height); return PanelPopupButton::widthForHeight(height);
@ -80,7 +80,9 @@ int KButton::widthForHeight(int height) const
int KButton::heightForWidth(int width) const int KButton::heightForWidth(int width) const
{ {
if (KickerSettings::showKMenuText()) { if (KickerSettings::showKMenuText()) {
return 30; int recommendation = PanelPopupButton::heightForWidth(width);
if (recommendation > KickerSettings::maximumTDEMenuButtonHeight()) recommendation = KickerSettings::maximumTDEMenuButtonHeight();
return recommendation;
} }
else { else {
return PanelPopupButton::heightForWidth(width); return PanelPopupButton::heightForWidth(width);

@ -150,11 +150,16 @@ void ButtonContainer::embedButton(PanelButton* b)
_button = b; _button = b;
_button->installEventFilter(this); _button->installEventFilter(this);
if (b->centerButtonInContainer()) { TQVBoxLayout* vbox = new TQVBoxLayout(this);
TQVBoxLayout* vbox = new TQVBoxLayout(this); if (!b->centerButtonInContainer()) {
vbox->addWidget(_button); b->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding);
_layout = vbox;
} }
vbox->addWidget(_button, 1);
if (!b->centerButtonInContainer()) {
TQSpacerItem* spacer = new TQSpacerItem(0, 0, TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding);
vbox->addItem(spacer);
}
_layout = vbox;
connect(_button, TQT_SIGNAL(requestSave()), TQT_SIGNAL(requestSave())); connect(_button, TQT_SIGNAL(requestSave()), TQT_SIGNAL(requestSave()));
connect(_button, TQT_SIGNAL(hideme(bool)), TQT_SLOT(hideRequested(bool))); connect(_button, TQT_SIGNAL(hideme(bool)), TQT_SLOT(hideRequested(bool)));

@ -434,6 +434,11 @@
<default>3</default> <default>3</default>
</entry> </entry>
<entry name="MaximumTDEMenuButtonHeight" key="MaximumTDEMenuButtonHeight" type="Int" >
<label>The maximum height of the TDE Menu button in pixels</label>
<default>30</default>
</entry>
<entry name="RemoveButtonsWhenBroken" type="Bool" > <entry name="RemoveButtonsWhenBroken" type="Bool" >
<label>Buttons that represent KServices (applications, primarily) watch for the removal of the service and delete themselves when this happens. This setting turns this off.</label> <label>Buttons that represent KServices (applications, primarily) watch for the removal of the service and delete themselves when this happens. This setting turns this off.</label>
<default>true</default> <default>true</default>

@ -31,6 +31,7 @@
#include <tdefileitem.h> #include <tdefileitem.h>
#include <kdebug.h> #include <kdebug.h>
#include <krun.h> #include <krun.h>
#include <kservice.h>
#undef Bool #undef Bool
@ -175,8 +176,9 @@ bool KFileIVI::showDirectoryOverlay( )
KIVFreeSpaceOverlay* KFileIVI::setShowFreeSpaceOverlay( bool show ) KIVFreeSpaceOverlay* KFileIVI::setShowFreeSpaceOverlay( bool show )
{ {
if ( !m_fileitem->mimetype().startsWith("media/") ) if ( !m_fileitem->mimetype().startsWith("media/") ) {
return 0; return 0;
}
if (show) { if (show) {
if (!d->m_freeSpaceOverlay) if (!d->m_freeSpaceOverlay)
@ -382,13 +384,31 @@ void KFileIVI::returnPressed()
{ {
if ( static_cast<KonqIconViewWidget*>(iconView())->isDesktop() ) { if ( static_cast<KonqIconViewWidget*>(iconView())->isDesktop() ) {
KURL url = m_fileitem->url(); KURL url = m_fileitem->url();
// When clicking on a link to e.g. $HOME from the desktop, we want to open $HOME if (url.protocol() == "media") {
// Symlink resolution must only happen on the desktop though (#63014) // The user reasonably expects to be placed within the media:/ tree
if ( m_fileitem->isLink() && url.isLocalFile() ) // when opening a media device from the desktop
url = KURL( url, m_fileitem->linkDest() ); KService::Ptr service = KService::serviceByDesktopName("konqueror");
if (service) {
(void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() ); // HACK
} else { // There doesn't seem to be a way to prevent KRun from resolving the URL to its
// local path, so simpy launch Konqueror with the correct arguments instead...
KRun::runCommand("konqueror " + url.url(), "konqueror", service->icon());
}
else {
(void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() );
}
}
else {
// When clicking on a link to e.g. $HOME from the desktop, we want to open $HOME
// Symlink resolution must only happen on the desktop though (#63014)
if ( m_fileitem->isLink() && url.isLocalFile() ) {
url = KURL( url, m_fileitem->linkDest() );
}
(void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() );
}
}
else {
m_fileitem->run(); m_fileitem->run();
} }
} }

@ -1,5 +1,5 @@
[Desktop Entry] [Desktop Entry]
ServiceTypes=media/cdrom_mounted,media/cdrom_mounted_decrypted,media/cdwriter_mounted,media/cdwriter_mounted_decrypted,media/dvd_mounted,media/dvd_mounted_decrypted,media/floppy5_mounted,media/floppy_mounted,media/hdd_mounted,media/hdd_mounted_decrypted,media/nfs_mounted,media/smb_mounted,media/zip_mounted,media/vcd,media/svcd,media/dvdvideo ServiceTypes=media/removable_mounted,media/removable_mounted_decrypted,media/cdrom_mounted,media/cdrom_mounted_decrypted,media/cdwriter_mounted,media/cdwriter_mounted_decrypted,media/dvd_mounted,media/dvd_mounted_decrypted,media/floppy5_mounted,media/floppy_mounted,media/hdd_mounted,media/hdd_mounted_decrypted,media/nfs_mounted,media/smb_mounted,media/zip_mounted,media/vcd,media/svcd,media/dvdvideo
Actions=MediaUnmount; Actions=MediaUnmount;
X-TDE-Priority=TopLevel X-TDE-Priority=TopLevel
X-TDE-MediaNotifierHide=true X-TDE-MediaNotifierHide=true

Loading…
Cancel
Save