Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 197535 | Differences between
and this patch

Collapse All | Expand All

(-)kmail/configuredialog.cpp (+28 lines)
Lines 2557-2562 Link Here
2557
  connect( mAutoAppSignFileCheck, SIGNAL( stateChanged(int) ),
2557
  connect( mAutoAppSignFileCheck, SIGNAL( stateChanged(int) ),
2558
           this, SLOT( slotEmitChanged( void ) ) );
2558
           this, SLOT( slotEmitChanged( void ) ) );
2559
2559
2560
  mTopQuoteCheck =
2561
    new QCheckBox( GlobalSettings::self()->prependSignatureItem()->label(), this );
2562
  mTopQuoteCheck->setEnabled( false );
2563
  vlay->addWidget( mTopQuoteCheck);
2564
  connect( mTopQuoteCheck, SIGNAL( stateChanged(int) ),
2565
           this, SLOT( slotEmitChanged( void ) ) );
2566
  connect( mAutoAppSignFileCheck, SIGNAL(toggled(bool)),
2567
           mTopQuoteCheck, SLOT(setEnabled(bool)) );
2568
2569
  mDashDashCheck =
2570
    new QCheckBox( GlobalSettings::self()->dashDashSignatureItem()->label(), this );
2571
  mDashDashCheck->setEnabled( false );
2572
  vlay->addWidget( mDashDashCheck);
2573
  connect( mDashDashCheck, SIGNAL( stateChanged(int) ),
2574
           this, SLOT( slotEmitChanged( void ) ) );
2575
  connect( mAutoAppSignFileCheck, SIGNAL(toggled(bool)),
2576
           mDashDashCheck, SLOT(setEnabled(bool)) );
2577
2560
  mSmartQuoteCheck = new QCheckBox(
2578
  mSmartQuoteCheck = new QCheckBox(
2561
           GlobalSettings::self()->smartQuoteItem()->label(),
2579
           GlobalSettings::self()->smartQuoteItem()->label(),
2562
           this, "kcfg_SmartQuote" );
2580
           this, "kcfg_SmartQuote" );
Lines 2674-2679 Link Here
2674
2689
2675
  mAutoAppSignFileCheck->setChecked(
2690
  mAutoAppSignFileCheck->setChecked(
2676
           GlobalSettings::self()->autoTextSignature()=="auto" );
2691
           GlobalSettings::self()->autoTextSignature()=="auto" );
2692
  mTopQuoteCheck->setChecked( GlobalSettings::self()->prependSignature() );
2693
  mDashDashCheck->setChecked( GlobalSettings::self()->dashDashSignature() );
2677
  mSmartQuoteCheck->setChecked( GlobalSettings::self()->smartQuote() );
2694
  mSmartQuoteCheck->setChecked( GlobalSettings::self()->smartQuote() );
2678
  mAutoRequestMDNCheck->setChecked( GlobalSettings::self()->requestMDN() );
2695
  mAutoRequestMDNCheck->setChecked( GlobalSettings::self()->requestMDN() );
2679
  mWordWrapCheck->setChecked( GlobalSettings::self()->wordWrap() );
2696
  mWordWrapCheck->setChecked( GlobalSettings::self()->wordWrap() );
Lines 2694-2699 Link Here
2694
    bool state = composer.readBoolEntry("signature");
2711
    bool state = composer.readBoolEntry("signature");
2695
    mAutoAppSignFileCheck->setChecked( state );
2712
    mAutoAppSignFileCheck->setChecked( state );
2696
  }
2713
  }
2714
  if ( composer.hasKey( "prepend-signature" ) )
2715
    mTopQuoteCheck->setChecked( composer.readBoolEntry( "prepend-signature" ) );
2716
2717
  if ( composer.hasKey( "dash-dash-signature" ) )
2718
    mDashDashCheck->setChecked( composer.readBoolEntry( "dash-dash-signature" ) );
2719
2697
  if ( composer.hasKey( "smart-quote" ) )
2720
  if ( composer.hasKey( "smart-quote" ) )
2698
    mSmartQuoteCheck->setChecked( composer.readBoolEntry( "smart-quote" ) );
2721
    mSmartQuoteCheck->setChecked( composer.readBoolEntry( "smart-quote" ) );
2699
  if ( composer.hasKey( "request-mdn" ) )
2722
  if ( composer.hasKey( "request-mdn" ) )
Lines 2715-2720 Link Here
2715
void ComposerPage::GeneralTab::save() {
2738
void ComposerPage::GeneralTab::save() {
2716
  GlobalSettings::self()->setAutoTextSignature(
2739
  GlobalSettings::self()->setAutoTextSignature(
2717
         mAutoAppSignFileCheck->isChecked() ? "auto" : "manual" );
2740
         mAutoAppSignFileCheck->isChecked() ? "auto" : "manual" );
2741
  GlobalSettings::self()->setPrependSignature( mTopQuoteCheck->isChecked());
2742
  GlobalSettings::self()->setDashDashSignature( mDashDashCheck->isChecked());
2718
  GlobalSettings::self()->setSmartQuote( mSmartQuoteCheck->isChecked() );
2743
  GlobalSettings::self()->setSmartQuote( mSmartQuoteCheck->isChecked() );
2719
  GlobalSettings::self()->setRequestMDN( mAutoRequestMDNCheck->isChecked() );
2744
  GlobalSettings::self()->setRequestMDN( mAutoRequestMDNCheck->isChecked() );
2720
  GlobalSettings::self()->setWordWrap( mWordWrapCheck->isChecked() );
2745
  GlobalSettings::self()->setWordWrap( mWordWrapCheck->isChecked() );
(-)kmail/configuredialog_p.h (+2 lines)
Lines 604-609 Link Here
604
604
605
private:
605
private:
606
  QCheckBox     *mAutoAppSignFileCheck;
606
  QCheckBox     *mAutoAppSignFileCheck;
607
  QCheckBox     *mTopQuoteCheck;
608
  QCheckBox     *mDashDashCheck;
607
  QCheckBox     *mSmartQuoteCheck;
609
  QCheckBox     *mSmartQuoteCheck;
608
  QCheckBox     *mAutoRequestMDNCheck;
610
  QCheckBox     *mAutoRequestMDNCheck;
609
  QCheckBox	*mShowRecentAddressesInComposer;
611
  QCheckBox	*mShowRecentAddressesInComposer;
(-)kmail/kmail.kcfg (-1 / +12 lines)
Lines 253-259 Link Here
253
        <default>false</default>
253
        <default>false</default>
254
      </entry>
254
      </entry>
255
      <entry name="AutoTextSignature" type="String" key="signature">
255
      <entry name="AutoTextSignature" type="String" key="signature">
256
        <label>A&amp;utomatically append signature</label>
256
        <label>A&amp;utomatically insert signature</label>
257
        <default>auto</default>
257
        <default>auto</default>
258
      </entry>
258
      </entry>
259
      <entry name="StickyIdentity" type="Bool" key="sticky-identity">
259
      <entry name="StickyIdentity" type="Bool" key="sticky-identity">
Lines 350-355 Link Here
350
        <whatsthis>A backup copy of the text in the composer window can be created regularly. The interval used to create the backups is set here. You can disable autosaving by setting it to the value 0.</whatsthis>
350
        <whatsthis>A backup copy of the text in the composer window can be created regularly. The interval used to create the backups is set here. You can disable autosaving by setting it to the value 0.</whatsthis>
351
        <default>2</default>
351
        <default>2</default>
352
      </entry>
352
      </entry>
353
354
      <entry name="PrependSignature" type="Bool" key="prepend-signature">
355
        <label>Insert signature above quoted text</label>
356
        <default>false</default>
357
      </entry>
358
359
      <entry name="DashDashSignature" type="Bool" key="dash-dash-signature">
360
        <label>Prepend separator (--) to signature</label>
361
        <default>true</default>
362
      </entry>
363
353
      <entry name="ReplyPrefixes" type="StringList" key="reply-prefixes">
364
      <entry name="ReplyPrefixes" type="StringList" key="reply-prefixes">
354
        <default>Re\\s*:,Re\\[\\d+\\]:,Re\\d+:</default>
365
        <default>Re\\s*:,Re\\[\\d+\\]:,Re\\d+:</default>
355
      </entry>
366
      </entry>
(-)kmail/kmcomposerui.rc (+3 lines)
Lines 63-68 Link Here
63
  <Menu name="attach" >
63
  <Menu name="attach" >
64
   <text>&amp;Attach</text>
64
   <text>&amp;Attach</text>
65
   <Action name="append_signature" />
65
   <Action name="append_signature" />
66
   <Action name="prepend_signature" />
67
   <Action name="insert_signature_at_cursor_position" />
68
   <Separator/>
66
   <Action name="attach_public_key" />
69
   <Action name="attach_public_key" />
67
   <Action name="attach_my_public_key" />
70
   <Action name="attach_my_public_key" />
68
   <Separator/>
71
   <Separator/>
(-)kmail/kmcomposewin.cpp (-10 / +67 lines)
Lines 1331-1336 Link Here
1331
  (void) new KAction (i18n("Append S&ignature"), 0, this,
1331
  (void) new KAction (i18n("Append S&ignature"), 0, this,
1332
                      SLOT(slotAppendSignature()),
1332
                      SLOT(slotAppendSignature()),
1333
                      actionCollection(), "append_signature");
1333
                      actionCollection(), "append_signature");
1334
  (void) new KAction (i18n("Prepend S&ignature"), 0, this,
1335
                      SLOT(slotPrependSignature()),
1336
                      actionCollection(), "prepend_signature");
1337
  (void) new KAction (i18n("Insert Signature At C&ursor Position"), "edit", 0, this,
1338
                      SLOT(slotInsertSignatureAtCursor()),
1339
                      actionCollection(), "insert_signature_at_cursor_position");
1340
1341
1334
  mAttachPK  = new KAction (i18n("Attach &Public Key..."), 0, this,
1342
  mAttachPK  = new KAction (i18n("Attach &Public Key..."), 0, this,
1335
                           SLOT(slotInsertPublicKey()),
1343
                           SLOT(slotInsertPublicKey()),
1336
                           actionCollection(), "attach_public_key");
1344
                           actionCollection(), "attach_public_key");
Lines 2022-2028 Link Here
2022
    // Not user friendy if this modal fileseletor opens before the
2030
    // Not user friendy if this modal fileseletor opens before the
2023
    // composer.
2031
    // composer.
2024
    //
2032
    //
2025
    QTimer::singleShot( 200, this, SLOT(slotAppendSignature()) );
2033
    //QTimer::singleShot( 200, this, SLOT(slotAppendSignature()) );
2034
      if ( GlobalSettings::self()->prependSignature() ) {
2035
        QTimer::singleShot( 0, this, SLOT(slotPrependSignature()) );
2036
      } else {
2037
        QTimer::singleShot( 0, this, SLOT(slotAppendSignature()) );
2038
      }
2039
2026
  }
2040
  }
2027
  setModified( isModified );
2041
  setModified( isModified );
2028
2042
Lines 4146-4151 Link Here
4146
//----------------------------------------------------------------------------
4160
//----------------------------------------------------------------------------
4147
void KMComposeWin::slotAppendSignature()
4161
void KMComposeWin::slotAppendSignature()
4148
{
4162
{
4163
    insertSignature();
4164
}
4165
4166
//----------------------------------------------------------------------------
4167
void KMComposeWin::slotPrependSignature()
4168
{
4169
    insertSignature( false );
4170
}
4171
4172
//----------------------------------------------------------------------------
4173
void KMComposeWin::slotInsertSignatureAtCursor()
4174
{
4175
    insertSignature( false, mEditor->currentLine() );
4176
}
4177
4178
//----------------------------------------------------------------------------
4179
void KMComposeWin::insertSignature( bool append, int pos )
4180
{
4149
  bool mod = mEditor->isModified();
4181
  bool mod = mEditor->isModified();
4150
4182
4151
  const KPIM::Identity & ident =
4183
  const KPIM::Identity & ident =
Lines 4150-4159 Link Here
4150
4180
4151
  const KPIM::Identity & ident =
4181
  const KPIM::Identity & ident =
4152
    kmkernel->identityManager()->identityForUoidOrDefault( mIdentity->currentIdentity() );
4182
    kmkernel->identityManager()->identityForUoidOrDefault( mIdentity->currentIdentity() );
4153
  mOldSigText = ident.signatureText();
4183
  mOldSigText = ident.signatureText();
4184
4185
  if ( !GlobalSettings::self()->dashDashSignature() && !mOldSigText.isEmpty() )
4186
    mOldSigText = mOldSigText.remove( 0, 4 );
4154
  if( !mOldSigText.isEmpty() )
4187
  if( !mOldSigText.isEmpty() )
4155
  {
4188
  {
4156
    mEditor->append(mOldSigText);
4189
    if ( append ) {
4190
      mEditor->append(mOldSigText);
4191
    } else {
4192
      mEditor->insertAt(mOldSigText, pos, 0);
4193
    }
4194
4157
    mEditor->setModified(mod);
4195
    mEditor->setModified(mod);
4158
    // mEditor->setContentsPos( 0, 0 );
4196
    // mEditor->setContentsPos( 0, 0 );
4159
    if (  mPreserveUserCursorPosition ) {
4197
    if (  mPreserveUserCursorPosition ) {
Lines 4156-4168 Link Here
4156
4200
4157
    mEditor->setModified(mod);
4201
    mEditor->setModified(mod);
4158
    // mEditor->setContentsPos( 0, 0 );
4202
    // mEditor->setContentsPos( 0, 0 );
4159
    if (  mPreserveUserCursorPosition ) {
4203
4160
      mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() );
4204
    // if the cursor is explicitly set in a template, set the cursor position
4161
      // Only keep the cursor from the mMsg *once* based on the
4205
    // to the template position, offsetting for the prepended signature length
4162
      // preserve-cursor-position setting; this handles the case where
4206
    // if applicable, otherwise set it to above the sig for {pre,ap}pend/insert
4163
      // the message comes from a template with a specific cursor
4207
    if (  mPreserveUserCursorPosition ) {
4164
      // position set and the signature is appended automatically.
4208
      if ( append && pos == 0 )
4165
      mPreserveUserCursorPosition = false;
4209
        mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() );
4166
    }
4210
      else
4211
        mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() + mOldSigText.length() );
4212
      // Only keep the cursor from the mMsg *once* based on the
4213
      // preserve-cursor-position setting; this handles the case where
4214
      // the message comes from a template with a specific cursor
4215
      // position set and the signature is appended automatically.
4216
      mPreserveUserCursorPosition = false;
4217
    } else { if ( append ) {
4218
          QString tmpMsgText = mEditor->text();
4219
          mEditor->setCursorPositionFromStart( tmpMsgText.length() - mOldSigText.length() );
4220
        }
4221
        else { if ( pos != 0 )
4222
            mEditor->setCursorPosition( pos, 0 );
4223
          else
4224
            mEditor->setCursorPosition( 0 , 0 );
4225
        }
4226
    }
4227
4167
    mEditor->sync();
4228
    mEditor->sync();
4168
  }
4229
  }
4169
}
4230
}
(-)kmail/kmcomposewin.cpp (-8 / +49 lines)
Lines 4500-4514 Link Here
4500
  while ( !mOldSigText.isEmpty() && mOldSigText[mOldSigText.length()-1].isSpace() )
4553
  while ( !mOldSigText.isEmpty() && mOldSigText[mOldSigText.length()-1].isSpace() )
4501
    mOldSigText.truncate( mOldSigText.length() - 1 );
4554
    mOldSigText.truncate( mOldSigText.length() - 1 );
4502
4555
4503
  if( edtText.endsWith( mOldSigText ) )
4556
  mNewSigText = ident.signatureText();
4504
    edtText.truncate( edtText.length() - mOldSigText.length() );
4557
  if ( !GlobalSettings::self()->dashDashSignature() && !mNewSigText.isEmpty() )
4558
    mNewSigText = mNewSigText.remove( 0, 4 );
4559
  // if the user has auto signatures enabled and a new sig, replace the
4560
  // current sig on identity change if there's a sig set, otherwise prepend
4561
  // the new sig if they want prepended, or append otherwise and finally 
4562
  // delete the sig if they don't have auto signatures enabled or if
4563
  // the new signature is empty and old sig isn't empty
4564
  if ( ( GlobalSettings::self()->autoTextSignature() == "auto" ) &&
4565
       !mNewSigText.isEmpty() ) {
4566
    if ( ( edtText.find( mOldSigText, 0, true) != -1 ) && !mOldSigText.isEmpty() ) {
4567
      edtText = edtText.replace( edtText.find( mOldSigText, 0, true),
4568
        mOldSigText.length(), mNewSigText );
4569
    } else { if ( GlobalSettings::self()->prependSignature() ) {
4570
          // if we have tracking info and I can find it in the text, place the
4571
          // sig there, otherwise prepend it (with \n\n if they've already typed)
4572
          if ( !mTrackSig.isNull() && ( edtText.find( mTrackSig, 0, true) != -1 ) ) {
4573
            edtText.insert( edtText.find( mTrackSig, 0, true) , mNewSigText );
4574
            mTrackSig = QString::null;
4575
          }
4576
          else { if ( mTrackSig == "!!!APPEND!!!" )
4577
              edtText.append( mNewSigText );
4578
            else { if ( !edtText[1].isSpace() )
4579
                edtText.prepend( mNewSigText + QString::fromLatin1( "\n\n" ) );
4580
              else
4581
                edtText.prepend( mNewSigText );
4582
            }
4583
          }
4584
      } else {
4585
        edtText.append( mNewSigText );
4586
      }
4587
    }
4588
  } else if ( !mOldSigText.isEmpty() ) {
4589
    // if switching to an ident with no sig, track its position for later in case
4590
    // the user switches to one with a sig for intelligent placement
4591
    // caveat: this is based on the assumption that the user won't change
4592
    // the 20 characters after the signature (seems reasonable in reply/fwd)
4593
    if ( mNewSigText.isEmpty() ) {
4594
      // oops, there's actually nothing after the signature, just append later
4595
      if ( edtText.find( mOldSigText, 0, true) + mOldSigText.length() == edtText.length() )
4596
        mTrackSig = "!!!APPEND!!!";
4597
      else
4598
        mTrackSig = edtText.mid( edtText.find( mOldSigText, 0, true) +
4599
          mOldSigText.length(), 20 );
4600
    }
4601
    edtText = edtText.remove( edtText.find( mOldSigText, 0, true),
4602
      mOldSigText.length() );
4603
  }
4604
  mOldSigText = mNewSigText;
4505
4605
4506
  // now append the new sig
4507
  mOldSigText = ident.signatureText();
4508
  if( ( !mOldSigText.isEmpty() ) &&
4509
      ( GlobalSettings::self()->autoTextSignature() == "auto" ) ) {
4510
    edtText.append( mOldSigText );
4511
  }
4512
  mEditor->setText( edtText );
4606
  mEditor->setText( edtText );
4513
4607
4514
  // disable certain actions if there is no PGP user identity set
4608
  // disable certain actions if there is no PGP user identity set
(-)kmail/kmcomposewin.h (-1 / +21 lines)
Lines 369-374 Link Here
369
  void slotAppendSignature();
369
  void slotAppendSignature();
370
370
371
  /**
371
  /**
372
   * Prepend signature file at the beginning of the text in the editor.
373
   */
374
  void slotPrependSignature();
375
376
  /**
377
   * Insert signature file at the cursor position of the text in the editor.
378
   */
379
  void slotInsertSignatureAtCursor();
380
381
  /**
372
   * Attach sender's public key.
382
   * Attach sender's public key.
373
   */
383
   */
374
  void slotInsertMyPublicKey();
384
  void slotInsertMyPublicKey();
Lines 663-668 Link Here
663
   */
673
   */
664
  void setTransport( const QString & transport );
674
  void setTransport( const QString & transport );
665
675
676
  /**
677
   * Helper to insert the signature of the current identy at the
678
   * beginning or end of the editor.
679
   */
680
  void insertSignature( bool append = true, int pos = 0 );
681
666
private slots:
682
private slots:
667
   /**
683
   /**
668
    * Compress an attachemnt with the given index
684
    * Compress an attachemnt with the given index
Lines 757-762 Link Here
757
  QMap<KIO::Job*, KURL> mAttachJobs;
773
  QMap<KIO::Job*, KURL> mAttachJobs;
758
  KURL::List mAttachFilesPending;
774
  KURL::List mAttachFilesPending;
759
  int mAttachFilesSend;
775
  int mAttachFilesSend;
776
777
  QString mTrackSig;
778
  QString mNewSigText;
760
779
761
private:
780
private:
762
  // helper method for slotInsert(My)PublicKey()
781
  // helper method for slotInsert(My)PublicKey()
763
-- libkpimidentities/identity.h        2006/11/02 10:03:21     601149
782
++ libkpimidentities/identity.h        2006/11/02 10:06:27     601150
Lines 227-232 Link Here
227
227
228
  void setSignature( const Signature & sig ) { mSignature = sig; }
228
  void setSignature( const Signature & sig ) { mSignature = sig; }
229
  Signature & signature() /* _not_ const! */ { return mSignature; }
229
  Signature & signature() /* _not_ const! */ { return mSignature; }
230
  const Signature & signature() const { return mSignature; }
230
231
231
protected:
232
protected:
232
  /** @return true if the signature is read from the output of a command */
233
  /** @return true if the signature is read from the output of a command */

Return to bug 197535