[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kio/kio
From: Kévin Ottens <ervin () ipsquad ! net>
Date: 2005-04-04 10:57:25
Message-ID: 20050404105725.D5C6E486 () office ! kde ! org
[Download RAW message or body]
CVS commit by ervin:
Add the ability to disable message box use from Jobs, because the can
be used with a KApplication with gui disabled (and then make it crash).
CCBUGS:102086
M +18 -3 job.cpp 1.436
M +19 -0 jobclasses.h 1.159
--- kdelibs/kio/kio/job.cpp #1.435:1.436
@@ -82,9 +82,10 @@ class Job::JobPrivate
{
public:
- JobPrivate() : m_autoErrorHandling( false ), m_parentJob( 0L ), m_extraFlags(0),
+ JobPrivate() : m_autoErrorHandling( false ), m_interactive( true ), m_parentJob( \
0L ), m_extraFlags(0), m_processedSize(0)
{}
bool m_autoErrorHandling;
+ bool m_interactive;
QGuardedPtr<QWidget> m_errorParentWidget;
// Maybe we could use the QObject parent/child mechanism instead
@@ -312,4 +313,14 @@ bool Job::isAutoErrorHandlingEnabled() c
}
+void Job::setInteractive(bool enable)
+{
+ d->m_interactive = enable;
+}
+
+bool Job::isInteractive() const
+{
+ return d->m_interactive;
+}
+
void Job::setWindow(QWidget *window)
{
@@ -554,4 +565,6 @@ void SimpleJob::slotError( int error, co
void SimpleJob::slotWarning( const QString & errorText )
{
+ if (!isInteractive()) return;
+
static uint msgBoxDisplayed = 0;
if ( msgBoxDisplayed == 0 ) // don't bomb the user with message boxes, only one \
at a time @@ -2599,4 +2612,5 @@ void CopyJob::statCurrentSrc()
if (m_mode == Move && !KProtocolInfo::supportsDeleting(m_currentSrcURL)) {
QGuardedPtr<CopyJob> that = this;
+ if (isInteractive())
KMessageBox::information( 0, buildErrorString(ERR_CANNOT_DELETE, \
m_currentSrcURL.prettyURL())); if (that)
@@ -3917,4 +3931,5 @@ void DeleteJob::statNextSrc()
QGuardedPtr<DeleteJob> that = this;
++m_currentStat;
+ if (isInteractive())
KMessageBox::information( 0, buildErrorString(ERR_CANNOT_DELETE, \
m_currentURL.prettyURL())); if (that)
--- kdelibs/kio/kio/jobclasses.h #1.158:1.159
@@ -179,4 +179,21 @@ namespace KIO {
/**
+ * Enable or disable the message display from the job.
+ *
+ * The default is true.
+ * @param enable enable or disable message display
+ * @since 3.4.1
+ */
+ void setInteractive(bool enable);
+
+ /**
+ * Returns whether message display is enabled or disabled.
+ * See also setInteractive .
+ * @return true if message display is enabled
+ * @see setInteractive()
+ * @since 3.4.1
+ */
+ bool isInteractive() const;
+ /**
* Associate this job with a window given by @p window.
* @param window the window to associate to
@@ -1487,4 +1504,6 @@ namespace KIO {
* If the program doesn't want CopyJob to show dialogs, but to simply fail \
on error,
* call setInteractive( false ).
+ *
+ * KDE4: remove, already in Job
* @since 3.4
*/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic