[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kmail
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2005-01-12 12:27:54
Message-ID: 20050112122754.D618A1B9D6 () office ! kde ! org
[Download RAW message or body]

CVS commit by cschumac: 

Align line edits.


  M +16 -5     kmcomposewin.cpp   1.911
  M +1 -0      kmcomposewin.h   1.272
  M +28 -1     recipientseditor.cpp   1.19
  M +7 -0      recipientseditor.h   1.12


--- kdepim/kmail/kmcomposewin.cpp  #1.910:1.911
@@ -157,5 +157,6 @@ KMComposeWin::KMComposeWin( KMMessage *a
     mEncodingAction( 0 ),
     mCryptoModuleAction( 0 ),
-    mComposer( 0 )
+    mComposer( 0 ),
+    mLabelWidth( 0 )
 {
   mClassicalRecipients = GlobalSettings::recipientsEditorType() ==
@@ -363,4 +363,11 @@ KMComposeWin::KMComposeWin( KMMessage *a
   rethinkFields();
 
+  if ( !mClassicalRecipients ) {
+    mRecipientsEditor->setFirstColumnWidth( mLabelWidth );
+    // This is ugly, but if it isn't called the line edits in the recipients
+    // editor aren't wide enough until the first resize event comes.
+    rethinkFields();
+  }
+
   if ( GlobalSettings::useExternalEditor() ) {
     mEditor->setUseExternalEditor(true);
@@ -921,4 +928,5 @@ void KMComposeWin::rethinkHeaderLine(int
     aLbl->setBuddy(aEdt);
     mGrid->addWidget(aLbl, aRow, 0);
+    if ( aLbl->width() > mLabelWidth ) mLabelWidth = aLbl->width();
 
     aEdt->setBackgroundColor( mBackColor );
@@ -926,10 +934,12 @@ void KMComposeWin::rethinkHeaderLine(int
     aEdt->setMinimumSize(100, aLbl->height()+2);
 
+    if (aBtn) {
     mGrid->addWidget(aEdt, aRow, 1);
-    if (aBtn)
-    {
+
       mGrid->addWidget(aBtn, aRow, 2);
       aBtn->setFixedSize(aBtn->sizeHint().width(), aLbl->height());
       aBtn->show();
+    } else {
+      mGrid->addMultiCellWidget(aEdt, aRow, aRow, 1, 2 );
     }
     aRow++;
@@ -957,4 +967,5 @@ void KMComposeWin::rethinkHeaderLine(int
     aLbl->setBuddy(aCbx);
     mGrid->addWidget(aLbl, aRow, 0);
+    if ( aLbl->width() > mLabelWidth ) mLabelWidth = aLbl->width();
 
     //    aCbx->setBackgroundColor( mBackColor );

--- kdepim/kmail/kmcomposewin.h  #1.271:1.272
@@ -927,4 +927,5 @@ private:
 
   RecipientsEditor *mRecipientsEditor;
+  int mLabelWidth;
 };
 

--- kdepim/kmail/recipientseditor.cpp  #1.18:1.19
@@ -228,4 +228,10 @@ void RecipientLine::keyPressEvent( QKeyE
 }
 
+void RecipientLine::setComboWidth( int w )
+{
+  mCombo->setFixedWidth( w );
+}
+
+
 RecipientsView::RecipientsView( QWidget *parent )
   : QScrollView( parent )
@@ -275,4 +281,6 @@ RecipientLine *RecipientsView::addLine()
   mLines.append( line );
 
+  line->setComboWidth( mFirstColumnWidth );
+
   mLineHeight = line->minimumSizeHint().height();
 
@@ -432,4 +440,18 @@ void RecipientsView::setFocusBottom()
 }
 
+void RecipientsView::setFirstColumnWidth( int w )
+{
+  mFirstColumnWidth = w;
+
+  QPtrListIterator<RecipientLine> it( mLines );
+  RecipientLine *line;
+  while( ( line = it.current() ) ) {
+    line->setComboWidth( mFirstColumnWidth );
+    ++it;
+  }
+
+  resizeView();
+}
+
 
 SideWidget::SideWidget( RecipientsView *view, QWidget *parent )
@@ -519,5 +541,5 @@ void RecipientsEditor::slotPickedRecipie
 {
   RecipientLine *line = mRecipientsView->activeLine();
-  line->setRecipient( rec );
+  line->setRecipient( Recipient( rec, line->recipientType() ) );
   
   mRecipientsView->addLine()->activate();
@@ -580,3 +602,8 @@ void RecipientsEditor::setFocusBottom()
 }
 
+void RecipientsEditor::setFirstColumnWidth( int w )
+{
+  mRecipientsView->setFirstColumnWidth( w );
+}
+
 #include "recipientseditor.moc"

--- kdepim/kmail/recipientseditor.h  #1.11:1.12
@@ -101,4 +101,6 @@ class RecipientLine : public QWidget
     bool isEmpty();
 
+    void setComboWidth( int w );
+
   signals:
     void returnPressed( RecipientLine * );
@@ -142,4 +144,6 @@ class RecipientsView : public QScrollVie
     void activateLine( RecipientLine * );
 
+    void setFirstColumnWidth( int );
+
   public slots:
     RecipientLine *addLine();
@@ -170,4 +174,5 @@ class RecipientsView : public QScrollVie
     RecipientLine* mCurDelLine;
     int mLineHeight;
+    int mFirstColumnWidth;
 };
 
@@ -212,4 +217,6 @@ class RecipientsEditor : public QWidget
     QString recipientString( Recipient::Type );
 
+    void setFirstColumnWidth( int );
+
   public slots:
     void setFocus();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic