~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to messageviewer/editorwatcher.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
*/
18
18
 
 
19
#include <config-messageviewer.h>
19
20
#include "editorwatcher.h"
20
21
#include "autoqpointer.h"
21
22
 
66
67
  list.append( mUrl );
67
68
  KService::Ptr offer = KMimeTypeTrader::self()->preferredService( mMimeType, "Application" );
68
69
  if ( mOpenWith || !offer ) {
 
70
#ifndef Q_OS_WINCE
69
71
    AutoQPointer<KOpenWithDialog> dlg( new KOpenWithDialog( list, i18n("Edit with:"),
70
72
                                                            QString(), mParentWidget ) );
71
73
    int dlgrc = dlg->exec();
73
75
      offer = dlg->service();
74
76
    }
75
77
    if ( !dlgrc || !offer )
 
78
#endif
76
79
      return false;
77
80
  }
78
81
 
88
91
      mFileModified = false;
89
92
    }
90
93
  } else {
91
 
    kWarning() <<"Failed to activate INOTIFY!";
 
94
    kWarning() << "Failed to activate INOTIFY!";
92
95
  }
93
96
#endif
94
97
 
147
150
{
148
151
  if ( mEditorRunning || (mFileOpen && mHaveInotify) || mDone )
149
152
    return;
 
153
 
 
154
  static QStringList readOnlyMimeTypes;
 
155
  if ( readOnlyMimeTypes.isEmpty() ) {
 
156
    readOnlyMimeTypes << "message/rfc822"
 
157
                      << "application/pdf";
 
158
  }
 
159
 
150
160
  // protect us against double-deletion by calling this method again while
151
161
  // the subeventloop of the message box is running
152
162
  mDone = true;
 
163
 
 
164
  // check if it's a mime type that's mostly handled read-only
 
165
  const bool isReadOnlyMimeType = ( readOnlyMimeTypes.contains( mMimeType ) ||
 
166
                                    mMimeType.startsWith( "image/" ) );
 
167
 
153
168
  // nobody can edit that fast, we seem to be unable to detect
154
169
  // when the editor will be closed
155
 
  if ( mEditTime.elapsed() <= 3000 ) {
156
 
    KMessageBox::error( mParentWidget,
 
170
  if ( mEditTime.elapsed() <= 3000 && !isReadOnlyMimeType ) {
 
171
    KMessageBox::information( mParentWidget,
157
172
                        i18n( "KMail is unable to detect when the chosen editor is closed. "
158
173
                              "To avoid data loss, editing the attachment will be aborted." ),
159
 
                        i18n( "Unable to edit attachment" ) );
 
174
                        i18n( "Unable to edit attachment" ),
 
175
                        "UnableToEditAttachment" );
160
176
  }
161
177
 
162
178
  emit editDone( this );