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

List:       kde-commits
Subject:    kdebase/kdeprint/kdeprintfax
From:       Michael Goffioul <goffioul () imec ! be>
Date:       2004-03-12 16:27:45
Message-ID: 20040312162745.CDA0F99A8 () office ! kde ! org
[Download RAW message or body]

CVS commit by goffioul: 

Add an option to automatically replace the international prefix char "+" with a \
user-defined string. This should cover the case where the underlying faxing tool does \
not support this char.


  M +19 -2     confgeneral.cpp   1.4
  M +3 -0      confgeneral.h   1.3
  M +7 -1      faxctrl.cpp   1.31


--- kdebase/kdeprint/kdeprintfax/confgeneral.h  #1.2:1.3
@@ -25,4 +25,5 @@
 
 class QLineEdit;
+class QCheckBox;
 
 class ConfGeneral : public QWidget
@@ -36,4 +37,6 @@ public:
 private:
         QLineEdit       *m_name, *m_company, *m_number;
+        QCheckBox   *m_replace_int_char;
+        QLineEdit   *m_replace_int_char_val;
 };
 

--- kdebase/kdeprint/kdeprintfax/confgeneral.cpp  #1.3:1.4
@@ -24,8 +24,10 @@
 #include <qlabel.h>
 #include <qlayout.h>
+#include <qcheckbox.h>
 
 #include <kglobal.h>
 #include <kconfig.h>
 #include <klocale.h>
+#include <kseparator.h>
 
 #include <stdlib.h>
@@ -43,8 +45,14 @@ ConfGeneral::ConfGeneral(QWidget *parent
         QLabel  *m_numberlabel = new QLabel(i18n("N&umber:"), this);
         m_numberlabel->setBuddy(m_number);
+        KSeparator *sep = new KSeparator( this );
+        m_replace_int_char = new QCheckBox( i18n( "Replace international prefix '+' \
with:" ), this ); +        m_replace_int_char_val = new QLineEdit( this );
+        m_replace_int_char_val->setEnabled( false );
 
-        QGridLayout     *l0 = new QGridLayout(this, 4, 2, 10, 10);
+        connect( m_replace_int_char, SIGNAL( toggled( bool ) ), \
m_replace_int_char_val, SLOT( setEnabled( bool ) ) ); +
+        QGridLayout     *l0 = new QGridLayout(this, 6, 2, 10, 10);
         l0->setColStretch(1, 1);
-        l0->setRowStretch(3, 1);
+        l0->setRowStretch(5, 1);
         l0->addWidget(m_namelabel, 0, 0);
         l0->addWidget(m_companylabel, 1, 0);
@@ -53,4 +61,9 @@ ConfGeneral::ConfGeneral(QWidget *parent
         l0->addWidget(m_company, 1, 1);
         l0->addWidget(m_number, 2, 1);
+        l0->addMultiCellWidget( sep, 3, 3, 0, 1 );
+        QHBoxLayout *l1 = new QHBoxLayout( this, 0, 10 );
+        l0->addMultiCellLayout( l1, 4, 4, 0, 1 );
+        l1->addWidget( m_replace_int_char );
+        l1->addWidget( m_replace_int_char_val );
 }
 
@@ -62,4 +75,6 @@ void ConfGeneral::load()
         m_number->setText(conf->readEntry("Number"));
         m_company->setText(conf->readEntry("Company"));
+        m_replace_int_char->setChecked( conf->readBoolEntry( "ReplaceIntChar", false \
) ); +        m_replace_int_char_val->setText( conf->readEntry( "ReplaceIntCharVal" ) \
);  }
 
@@ -71,3 +86,5 @@ void ConfGeneral::save()
         conf->writeEntry("Number", m_number->text());
         conf->writeEntry("Company", m_company->text());
+        conf->writeEntry( "ReplaceIntChar", m_replace_int_char->isChecked() );
+        conf->writeEntry( "ReplaceIntCharVal", m_replace_int_char_val->text() );
 }

--- kdebase/kdeprint/kdeprintfax/faxctrl.cpp  #1.30:1.31
@@ -58,7 +58,13 @@
 static QString stripNumber( const QString& s )
 {
+        KConfig *conf = KGlobal::config();
+        conf->setGroup( "Personal" );
+
         // removes any non-numeric character, except '+' (hope it's supported by \
faxing tools)  QString strip_s = s;
-        return strip_s.replace( QRegExp( "[^\\d+]" ), "" );
+        strip_s.replace( QRegExp( "[^\\d+]" ), "" );
+        if ( strip_s.find( '+' ) != -1 && conf->readBoolEntry( "ReplaceIntChar", \
false ) ) +                strip_s.replace( "+", conf->readEntry( "ReplaceIntCharVal" \
) ); +        return strip_s;
 }
 


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

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