summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-27 19:29:38 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-12-27 19:29:38 -0600
commitb876907e650eaf996aa3c2bcfac9a526cf900c5b (patch)
tree513671ea3db58c11b28de8ee74f51ff35be6b9c8
parentee68bc1fd3d2e5edc1527bdfcacfb330b7670a86 (diff)
downloadtdebase-b876907e650eaf996aa3c2bcfac9a526cf900c5b.tar.gz
tdebase-b876907e650eaf996aa3c2bcfac9a526cf900c5b.zip
Fix free space overlay not disappearing on unmount
Fix devices disappearing on unmount Automatically close notification popup on associated media device removal
-rw-r--r--kdesktop/kdiconview.cc44
-rw-r--r--kdesktop/kdiconview.h4
-rw-r--r--kdesktop/lock/lockprocess.cc4
-rw-r--r--konqueror/iconview/konq_iconview.cc49
-rw-r--r--konqueror/iconview/konq_iconview.h2
-rw-r--r--libkonq/konq_iconviewwidget.cc2
-rw-r--r--tdeioslave/media/mediamanager/mediamanager.cpp5
-rw-r--r--tdeioslave/media/medianotifier/medianotifier.cpp45
-rw-r--r--tdeioslave/media/medianotifier/medianotifier.h5
-rw-r--r--tdeioslave/media/medianotifier/notificationdialog.cpp6
-rw-r--r--tdeioslave/media/medianotifier/notificationdialog.h2
11 files changed, 116 insertions, 52 deletions
diff --git a/kdesktop/kdiconview.cc b/kdesktop/kdiconview.cc
index f757d70b9..948ea511c 100644
--- a/kdesktop/kdiconview.cc
+++ b/kdesktop/kdiconview.cc
@@ -151,7 +151,7 @@ KDIconView::KDIconView( TQWidget *parent, const char* name )
m_enableMedia(false),
m_gotIconsArea(false),
m_needDesktopAlign(true),
- m_paOutstandingOverlaysTimer( 0L )
+ m_paOutstandingFreeSpaceOverlaysTimer( 0L )
{
setResizeMode( Fixed );
setIconArea( desktopRect() ); // the default is the whole desktop
@@ -1223,8 +1223,14 @@ void KDIconView::slotNewItems( const KFileItemList & entries )
}
KFileItem* fileItem = fileIVI->item();
- if ( fileItem->mimetype().startsWith("media/") && fileItem->mimetype().contains("_mounted") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
- showFreeSpaceOverlay(fileIVI);
+ if ( fileItem->mimetype().startsWith("media/") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
+ if (fileItem->mimetype().contains("_mounted")) {
+ showFreeSpaceOverlay(fileIVI);
+ }
+ else {
+ // If not mounted, hide free space overlay
+ fileIVI->setShowFreeSpaceOverlay(false);
+ }
}
}
@@ -1281,8 +1287,14 @@ void KDIconView::slotRefreshItems( const KFileItemList & entries )
if ( rit.current()->isMimeTypeKnown() ) {
fileIVI->setMouseOverAnimation( rit.current()->iconName() );
}
- if ( rit.current()->mimetype().startsWith("media/") && rit.current()->mimetype().contains("_mounted") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
- showFreeSpaceOverlay(fileIVI);
+ if ( rit.current()->mimetype().startsWith("media/") && KDesktopSettings::mediaFreeSpaceDisplayEnabled() ) {
+ if (rit.current()->mimetype().contains("_mounted")) {
+ showFreeSpaceOverlay(fileIVI);
+ }
+ else {
+ // If not mounted, hide free space overlay
+ fileIVI->setShowFreeSpaceOverlay(false);
+ }
}
break;
}
@@ -1381,15 +1393,15 @@ void KDIconView::showFreeSpaceOverlay(KFileIVI* item)
KFileItem* fileItem = item->item();
if ( TDEGlobalSettings::showFilePreview( fileItem->url() ) ) {
- m_paOutstandingOverlays.append(item);
- if (m_paOutstandingOverlays.count() == 1)
+ m_paOutstandingFreeSpaceOverlays.append(item);
+ if (m_paOutstandingFreeSpaceOverlays.count() == 1)
{
- if (!m_paOutstandingOverlaysTimer)
+ if (!m_paOutstandingFreeSpaceOverlaysTimer)
{
- m_paOutstandingOverlaysTimer = new TQTimer(this);
- connect(m_paOutstandingOverlaysTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotFreeSpaceOverlayStart()));
+ m_paOutstandingFreeSpaceOverlaysTimer = new TQTimer(this);
+ connect(m_paOutstandingFreeSpaceOverlaysTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotFreeSpaceOverlayStart()));
}
- m_paOutstandingOverlaysTimer->start(20, true);
+ m_paOutstandingFreeSpaceOverlaysTimer->start(20, true);
}
}
}
@@ -1398,7 +1410,7 @@ void KDIconView::slotFreeSpaceOverlayStart()
{
do
{
- KFileIVI* item = m_paOutstandingOverlays.first();
+ KFileIVI* item = m_paOutstandingFreeSpaceOverlays.first();
if (!item) {
return; // Nothing to do
}
@@ -1411,16 +1423,16 @@ void KDIconView::slotFreeSpaceOverlayStart()
overlay->start(); // Watch out, may emit finished() immediately!!
return; // Let it run....
}
- m_paOutstandingOverlays.removeFirst();
+ m_paOutstandingFreeSpaceOverlays.removeFirst();
} while (true);
}
void KDIconView::slotFreeSpaceOverlayFinished()
{
- m_paOutstandingOverlays.removeFirst();
+ m_paOutstandingFreeSpaceOverlays.removeFirst();
- if (m_paOutstandingOverlays.count() > 0) {
- m_paOutstandingOverlaysTimer->start(0, true); // Don't call directly to prevent deep recursion.
+ if (m_paOutstandingFreeSpaceOverlays.count() > 0) {
+ m_paOutstandingFreeSpaceOverlaysTimer->start(0, true); // Don't call directly to prevent deep recursion.
}
}
diff --git a/kdesktop/kdiconview.h b/kdesktop/kdiconview.h
index 963c10a2b..7b20e1817 100644
--- a/kdesktop/kdiconview.h
+++ b/kdesktop/kdiconview.h
@@ -278,8 +278,8 @@ private:
TQListView *mMediaListView;
- TQPtrList<KFileIVI> m_paOutstandingOverlays;
- TQTimer *m_paOutstandingOverlaysTimer;
+ TQPtrList<KFileIVI> m_paOutstandingFreeSpaceOverlays;
+ TQTimer *m_paOutstandingFreeSpaceOverlaysTimer;
TDEConfig *g_pConfig;
};
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc
index a90f15c09..812f2a6d6 100644
--- a/kdesktop/lock/lockprocess.cc
+++ b/kdesktop/lock/lockprocess.cc
@@ -2391,10 +2391,14 @@ static int run_vkbd = -1;
void LockProcess::showVkbd()
{
if( run_vkbd == - 1 ) {
+#ifdef WITH_HAL
int status = system( "hal-find-by-property --key system.formfactor.subtype --string tabletpc" );
// status = 0; // enable for testing
run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0
&& !TDEStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0;
+#else // WITH_HAL
+ run_vkbd = (!TDEStandardDirs::findExe( "xvkbd" ).isEmpty());
+#endif // WITH_HAL
}
if( run_vkbd ) {
mVkbdWindows.clear();
diff --git a/konqueror/iconview/konq_iconview.cc b/konqueror/iconview/konq_iconview.cc
index 6e6a6fb4a..7ff2db6e9 100644
--- a/konqueror/iconview/konq_iconview.cc
+++ b/konqueror/iconview/konq_iconview.cc
@@ -170,6 +170,7 @@ KonqKfmIconView::KonqKfmIconView( TQWidget *parentWidget, TQObject *parent, cons
, m_bNeedSetCurrentItem( false )
, m_pEnsureVisible( 0 )
, m_paOutstandingOverlaysTimer( 0 )
+ , m_paOutstandingFreeSpaceOverlaysTimer( 0 )
, m_pTimeoutRefreshTimer( 0 )
, m_itemDict( 43 )
{
@@ -1083,8 +1084,11 @@ void KonqKfmIconView::slotDeleteItem( KFileItem * _fileitem )
m_itemDict.remove( _fileitem );
if (m_paOutstandingOverlays.first() == ivi) // Being processed?
m_paOutstandingOverlaysTimer->start(20, true); // Restart processing...
-
m_paOutstandingOverlays.remove(ivi);
+ if (m_paOutstandingFreeSpaceOverlays.first() == ivi) // Being processed?
+ m_paOutstandingFreeSpaceOverlaysTimer->start(20, true); // Restart processing...
+ m_paOutstandingFreeSpaceOverlays.remove(ivi);
+
delete ivi;
}
}
@@ -1112,18 +1116,16 @@ void KonqKfmIconView::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);
- }
+ m_paOutstandingFreeSpaceOverlays.append(item);
+ if (m_paOutstandingFreeSpaceOverlays.count() == 1)
+ {
+ if (!m_paOutstandingFreeSpaceOverlaysTimer)
+ {
+ m_paOutstandingFreeSpaceOverlaysTimer = new TQTimer(this);
+ connect(m_paOutstandingFreeSpaceOverlaysTimer, TQT_SIGNAL(timeout()),
+ TQT_SLOT(slotFreeSpaceOverlayStart()));
+ }
+ m_paOutstandingFreeSpaceOverlaysTimer->start(20, true);
}
}
@@ -1151,7 +1153,7 @@ void KonqKfmIconView::slotFreeSpaceOverlayStart()
{
do
{
- KFileIVI* item = m_paOutstandingOverlays.first();
+ KFileIVI* item = m_paOutstandingFreeSpaceOverlays.first();
if (!item)
return; // Nothing to do
@@ -1163,7 +1165,7 @@ void KonqKfmIconView::slotFreeSpaceOverlayStart()
overlay->start(); // Watch out, may emit finished() immediately!!
return; // Let it run....
}
- m_paOutstandingOverlays.removeFirst();
+ m_paOutstandingFreeSpaceOverlays.removeFirst();
} while (true);
}
@@ -1177,10 +1179,10 @@ void KonqKfmIconView::slotDirectoryOverlayFinished()
void KonqKfmIconView::slotFreeSpaceOverlayFinished()
{
- m_paOutstandingOverlays.removeFirst();
+ m_paOutstandingFreeSpaceOverlays.removeFirst();
- if (m_paOutstandingOverlays.count() > 0)
- m_paOutstandingOverlaysTimer->start(0, true); // Don't call directly to prevent deep recursion.
+ if (m_paOutstandingFreeSpaceOverlays.count() > 0)
+ m_paOutstandingFreeSpaceOverlaysTimer->start(0, true); // Don't call directly to prevent deep recursion.
}
// see also KDesktop::slotRefreshItems
@@ -1211,8 +1213,14 @@ void KonqKfmIconView::slotRefreshItems( const KFileItemList& entries )
if ( !bNeedRepaint && oldSize != ivi->pixmap()->size() ) {
bNeedRepaint = true;
}
- if ( (*rit)->mimetype().startsWith("media/") && (*rit)->mimetype().contains("_mounted") && m_pProps->isShowingFreeSpaceOverlays() ) {
- showFreeSpaceOverlay(ivi);
+ if ( (*rit)->mimetype().startsWith("media/") && m_pProps->isShowingFreeSpaceOverlays() ) {
+ if ((*rit)->mimetype().contains("_mounted")) {
+ showFreeSpaceOverlay(ivi);
+ }
+ else {
+ // If not mounted, hide free space overlay
+ ivi->setShowFreeSpaceOverlay(false);
+ }
}
}
}
@@ -1380,6 +1388,7 @@ bool KonqKfmIconView::doOpenURL( const KURL & url )
m_bUpdateContentsPosAfterListing = true;
m_paOutstandingOverlays.clear();
+ m_paOutstandingFreeSpaceOverlays.clear();
// Start the directory lister !
m_dirLister->openURL( url, false, args.reload );
diff --git a/konqueror/iconview/konq_iconview.h b/konqueror/iconview/konq_iconview.h
index d66cc4cc8..5a5f0a1ac 100644
--- a/konqueror/iconview/konq_iconview.h
+++ b/konqueror/iconview/konq_iconview.h
@@ -202,7 +202,9 @@ protected:
TDEToggleAction *m_paFreeSpaceOverlays;
TDEToggleAction *m_paEnablePreviews;
TQPtrList<KFileIVI> m_paOutstandingOverlays;
+ TQPtrList<KFileIVI> m_paOutstandingFreeSpaceOverlays;
TQTimer *m_paOutstandingOverlaysTimer;
+ TQTimer *m_paOutstandingFreeSpaceOverlaysTimer;
/* TDEToggleAction *m_paImagePreview;
TDEToggleAction *m_paTextPreview;
TDEToggleAction *m_paHTMLPreview;*/
diff --git a/libkonq/konq_iconviewwidget.cc b/libkonq/konq_iconviewwidget.cc
index c5d255bf8..8cb222659 100644
--- a/libkonq/konq_iconviewwidget.cc
+++ b/libkonq/konq_iconviewwidget.cc
@@ -1422,6 +1422,8 @@ void KonqIconViewWidget::slotSaveIconPositions()
// in tdebase/kdesktop/kdiconview.cc
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+ printf("WARNING: Strongly deprecated method KonqIconViewWidget::slotSaveIconPositions() called!\n"); fflush(stdout);
+
if ( m_dotDirectoryPath.isEmpty() )
return;
if ( !m_bDesktop )
diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp
index 9a4089ca5..b08c37794 100644
--- a/tdeioslave/media/mediamanager/mediamanager.cpp
+++ b/tdeioslave/media/mediamanager/mediamanager.cpp
@@ -44,7 +44,6 @@
#include "linuxcdpolling.h"
#endif //COMPILE_LINUXCDPOLLING
-
MediaManager::MediaManager(const TQCString &obj)
: KDEDModule(obj), m_dirNotify(m_mediaList)
{
@@ -401,10 +400,6 @@ void MediaManager::slotMediumChanged(const TQString &/*id*/, const TQString &nam
kdDebug(1219) << "MediaManager::slotMediumChanged: " << name << endl;
KDirNotify_stub notifier("*", "*");
- if (!mounted)
- {
- notifier.FilesRemoved( KURL("media:/"+name) );
- }
notifier.FilesChanged( KURL("media:/"+name) );
emit mediumChanged(name, allowNotification);
diff --git a/tdeioslave/media/medianotifier/medianotifier.cpp b/tdeioslave/media/medianotifier/medianotifier.cpp
index bb8948db8..2db917b25 100644
--- a/tdeioslave/media/medianotifier/medianotifier.cpp
+++ b/tdeioslave/media/medianotifier/medianotifier.cpp
@@ -51,10 +51,14 @@ MediaNotifier::MediaNotifier(const TQCString &name) : KDEDModule(name)
connectDCOPSignal( "kded", "mediamanager", "mediumChanged(TQString, bool)",
"onMediumChange(TQString, bool)", true );
- m_freeTimer = new TQTimer( this );
- connect( m_freeTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( checkFreeDiskSpace() ) );
- m_freeTimer->start( 1000*6*2 /* 20 minutes */ );
- m_freeDialog = 0;
+ connectDCOPSignal( "kded", "mediamanager", "mediumRemoved(TQString, bool)",
+ "onMediumRemove(TQString, bool)", true );
+
+ m_notificationDialogList.setAutoDelete(FALSE);
+ m_freeTimer = new TQTimer( this );
+ connect( m_freeTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( checkFreeDiskSpace() ) );
+ m_freeTimer->start( 1000*6*2 /* 20 minutes */ );
+ m_freeDialog = 0;
}
MediaNotifier::~MediaNotifier()
@@ -64,6 +68,24 @@ MediaNotifier::~MediaNotifier()
disconnectDCOPSignal( "kded", "mediamanager", "mediumChanged(TQString, bool)",
"onMediumChange(TQString, bool)" );
+
+ disconnectDCOPSignal( "kded", "mediamanager", "mediumRemoved(TQString, bool)",
+ "onMediumRemove(TQString, bool)" );
+}
+
+void MediaNotifier::onMediumRemove( const TQString &name, bool allowNotification )
+{
+ kdDebug() << "MediaNotifier::onMediumRemove( " << name << ", "
+ << allowNotification << ")" << endl;
+
+ KURL url( "system:/media/"+name );
+
+ NotificationDialog* dialog;
+ for (dialog = m_notificationDialogList.first(); dialog; dialog = m_notificationDialogList.next()) {
+ if (dialog->medium().url() == url) {
+ dialog->close();
+ }
+ }
}
void MediaNotifier::onMediumChange( const TQString &name, bool allowNotification )
@@ -305,16 +327,16 @@ void MediaNotifier::notify( KFileItem &medium )
if ( settings->autoActionForMimetype( medium.mimetype() )==0L )
{
- TQValueList<NotifierAction*> actions
- = settings->actionsForMimetype( medium.mimetype() );
+ TQValueList<NotifierAction*> actions = settings->actionsForMimetype( medium.mimetype() );
// If only one action remains, it's the "do nothing" action
// no need to popup in this case.
if ( actions.size()>1 )
{
- NotificationDialog *dialog
- = new NotificationDialog( medium, settings );
- dialog->show();
+ NotificationDialog* notifier = new NotificationDialog( medium, settings );
+ connect(notifier, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(notificationDialogDestroyed(TQObject*)));
+ m_notificationDialogList.append(notifier);
+ notifier->show();
}
}
else
@@ -325,6 +347,11 @@ void MediaNotifier::notify( KFileItem &medium )
}
}
+void MediaNotifier::notificationDialogDestroyed(TQObject* object)
+{
+ m_notificationDialogList.remove(static_cast<NotificationDialog*>(object));
+}
+
extern "C"
{
KDE_EXPORT KDEDModule *create_medianotifier(const TQCString &name)
diff --git a/tdeioslave/media/medianotifier/medianotifier.h b/tdeioslave/media/medianotifier/medianotifier.h
index 3e30d12b1..84eee525c 100644
--- a/tdeioslave/media/medianotifier/medianotifier.h
+++ b/tdeioslave/media/medianotifier/medianotifier.h
@@ -29,6 +29,8 @@
#include <tqmap.h>
class KDialogBase;
+class NotificationDialog;
+typedef TQPtrList<NotificationDialog> NotificationDialogList;
class MediaNotifier: public KDEDModule
{
@@ -41,6 +43,7 @@ public:
k_dcop:
void onMediumChange( const TQString &name, bool allowNotification );
+ void onMediumRemove( const TQString &name, bool allowNotification );
private slots:
void slotStatResult( TDEIO::Job *job );
@@ -48,6 +51,7 @@ private slots:
void slotFreeFinished( KMessageBox::ButtonCode );
void slotFreeContinue();
void slotFreeCancel();
+ void notificationDialogDestroyed( TQObject* );
private:
bool autostart( const KFileItem &medium );
@@ -61,6 +65,7 @@ private:
TQMap<TDEIO::Job*,bool> m_allowNotificationMap;
TQTimer * m_freeTimer;
KDialogBase * m_freeDialog;
+ NotificationDialogList m_notificationDialogList;
};
#endif
diff --git a/tdeioslave/media/medianotifier/notificationdialog.cpp b/tdeioslave/media/medianotifier/notificationdialog.cpp
index 981d48e6a..c9a920f99 100644
--- a/tdeioslave/media/medianotifier/notificationdialog.cpp
+++ b/tdeioslave/media/medianotifier/notificationdialog.cpp
@@ -28,6 +28,7 @@
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqpushbutton.h>
+#include <tdehardwaredevices.h>
#include "actionlistboxitem.h"
#include "notificationdialogview.h"
@@ -86,6 +87,11 @@ NotificationDialog::~NotificationDialog()
delete m_settings;
}
+KFileItem NotificationDialog::medium()
+{
+ return m_medium;
+}
+
void NotificationDialog::updateActionsListBox()
{
m_view->actionsList->clear();
diff --git a/tdeioslave/media/medianotifier/notificationdialog.h b/tdeioslave/media/medianotifier/notificationdialog.h
index d50baa492..16bedb842 100644
--- a/tdeioslave/media/medianotifier/notificationdialog.h
+++ b/tdeioslave/media/medianotifier/notificationdialog.h
@@ -38,6 +38,8 @@ public:
TQWidget* parent = 0, const char* name = 0 );
~NotificationDialog();
+ KFileItem medium();
+
private slots:
void slotOk();
void slotConfigure();