Note: this doesn't depend on kdelibs trunk yet, copied the macro for now,

will change that on monday.

Merged revisions 935217 via svnmerge from 
svn+ssh://tmcguire@svn.kde.org/home/kde/branches/kdepim/enterprise4/kdepim

........
  r935217 | tmcguire | 2009-03-04 18:00:41 +0100 (Wed, 04 Mar 2009) | 13 lines
  
  You'll need an up-to-date e4-kdelibs for this!
  
  Introduce the CMake variable ENTERPRISE_BUILD.
  Now, a config-enterprise.h is created, which you can
  #include to have enterprise-specifc behavior.
  
  This is used in KMail for the "too many recipients"
  warning and the default forward type combobox, which
  I don't really want in trunk. The GUI option is disabled
  here.
  The default too-many-recipients warning is disabled by default for
  non-enterprise builds, with some cmake magic.
........

svn path=/trunk/KDE/kdepim/; revision=935266
wilder-work
Thomas McGuire 17 years ago
commit 3382253d96
  1. 60
      CMakeLists.txt
  2. 20
      configuredialog.cpp
  3. 8
      configuredialog_p.h
  4. 2
      kmail.kcfg.cmake

@ -310,7 +310,62 @@ kde4_add_ui_files(kmailprivate_LIB_SRCS
ui/identitypage.ui
)
kde4_add_kcfg_files(kmailprivate_LIB_SRCS
# KCFG files. The main kmail.kcfg is configured by CMake and put
# in the build directory.
macro (KMAIL_ADD_KCFG_FILES _sources )
if( ${ARGV1} STREQUAL "GENERATE_MOC" )
set(_kcfg_generatemoc TRUE)
endif( ${ARGV1} STREQUAL "GENERATE_MOC" )
foreach (_current_FILE ${ARGN})
if(NOT ${_current_FILE} STREQUAL "GENERATE_MOC")
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
get_filename_component(_abs_PATH ${_tmp_FILE} PATH)
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
file(READ ${_tmp_FILE} _contents)
string(REGEX REPLACE "^(.*\n)?File=([^\n]+kcfg).*\n.*$" "\\2" _kcfg_FILE "${_contents}")
set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
set(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
set(_kcfg_PATH ${_abs_PATH}/${_kcfg_FILE})
# Maybe the .kcfg is a generated file?
if(NOT EXISTS "${_kcfg_PATH}")
set(_kcfg_PATH ${CMAKE_CURRENT_BINARY_DIR}/${_kcfg_FILE})
endif(NOT EXISTS "${_kcfg_PATH}")
if(NOT EXISTS "${_kcfg_PATH}")
message(ERROR "${_kcfg_FILE} not found; tried in ${_abs_PATH} and ${CMAKE_CURRENT_BINARY_DIR}")
endif(NOT EXISTS "${_kcfg_PATH}")
# the command for creating the source file from the kcfg file
add_custom_command(OUTPUT ${_header_FILE} ${_src_FILE}
COMMAND ${KDE4_KCFGC_EXECUTABLE}
ARGS ${_kcfg_PATH} ${_tmp_FILE} -d ${CMAKE_CURRENT_BINARY_DIR}
MAIN_DEPENDENCY ${_tmp_FILE}
DEPENDS ${_kcfg_PATH} ${_KDE4_KCONFIG_COMPILER_DEP} )
if(_kcfg_generatemoc)
qt4_generate_moc(${_header_FILE} ${_moc_FILE} )
set_source_files_properties(${_src_FILE} PROPERTIES SKIP_AUTOMOC TRUE) # don't run automoc on this file
list(APPEND ${_sources} ${_moc_FILE})
endif(_kcfg_generatemoc)
list(APPEND ${_sources} ${_src_FILE} ${_header_FILE})
endif(NOT ${_current_FILE} STREQUAL "GENERATE_MOC")
endforeach (_current_FILE)
endmacro (KMAIL_ADD_KCFG_FILES)
if(ENTERPRISE_BUILD)
set(WARN_TOOMANY_RECIPIENTS_DEFAULT true)
else(ENTERPRISE_BUILD)
set(WARN_TOOMANY_RECIPIENTS_DEFAULT false)
endif(ENTERPRISE_BUILD)
configure_file(kmail.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/kmail.kcfg)
kmail_add_kcfg_files(kmailprivate_LIB_SRCS
globalsettings_base.kcfgc
replyphrases.kcfgc
custommimeheader.kcfgc
@ -422,7 +477,7 @@ install(TARGETS kmailprivate ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SK
install(TARGETS kmail ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES KMail.desktop kmail_view.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES
kmail.kcfg
${CMAKE_CURRENT_BINARY_DIR}/kmail.kcfg
replyphrases.kcfg
custommimeheader.kcfg
customtemplates_kfg.kcfg
@ -465,4 +520,3 @@ install(FILES
${CMAKE_BINARY_DIR}/kmail/org.kde.kmail.mailcomposer.xml
DESTINATION ${KDE4_DBUS_INTERFACES_DIR}
)

@ -20,6 +20,8 @@
*
*/
#include <config-enterprise.h>
// my headers:
#include "configuredialog.h"
#include "configuredialog_p.h"
@ -2857,6 +2859,7 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent )
connect( mWordWrapCheck, SIGNAL(toggled(bool)),
mWrapColumnSpin, SLOT(setEnabled(bool)) );
#ifdef ENTERPRISE_BUILD
// a checkbox for "too many recipient warning" and a spinbox for the recipient threshold
hlay = new QHBoxLayout(); // inherits spacing
vlay->addLayout( hlay );
@ -2890,6 +2893,7 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent )
// only enable the spinbox if the checkbox is checked:
connect( mRecipientCheck, SIGNAL(toggled(bool)),
mRecipientSpin, SLOT(setEnabled(bool)) );
#endif
hlay = new QHBoxLayout(); // inherits spacing
vlay->addLayout( hlay );
@ -2905,6 +2909,7 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent )
connect( mAutoSave, SIGNAL( valueChanged(int) ),
this, SLOT( slotEmitChanged( void ) ) );
#ifdef ENTERPRISE_BUILD
hlay = new QHBoxLayout(); // inherits spacing
vlay->addLayout( hlay );
mForwardTypeCombo = new KComboBox( false, this );
@ -2918,6 +2923,7 @@ ComposerPageGeneralTab::ComposerPageGeneralTab( QWidget * parent )
hlay->addStretch( 1 );
connect( mForwardTypeCombo, SIGNAL( activated( int ) ),
this, SLOT( slotEmitChanged() ) );
#endif
hlay = new QHBoxLayout(); // inherits spacing
vlay->addLayout( hlay );
@ -2995,13 +3001,16 @@ void ComposerPage::GeneralTab::doLoadFromGlobalSettings() {
mAutoRequestMDNCheck->setChecked( GlobalSettings::self()->requestMDN() );
mWordWrapCheck->setChecked( GlobalSettings::self()->wordWrap() );
mWrapColumnSpin->setValue( GlobalSettings::self()->lineWrapWidth() );
mAutoSave->setValue( GlobalSettings::self()->autosaveInterval() );
#ifdef ENTERPRISE_BUILD
mRecipientCheck->setChecked( GlobalSettings::self()->tooManyRecipients() );
mRecipientSpin->setValue( GlobalSettings::self()->recipientThreshold() );
mAutoSave->setValue( GlobalSettings::self()->autosaveInterval() );
if ( GlobalSettings::self()->forwardingInlineByDefault() )
mForwardTypeCombo->setCurrentIndex( 0 );
else
mForwardTypeCombo->setCurrentIndex( 1 );
#endif
// editor group:
mExternalEditorCheck->setChecked( GlobalSettings::self()->useExternalEditor() );
@ -3028,10 +3037,14 @@ void ComposerPage::GeneralTab::installProfile( KConfig * profile ) {
mWordWrapCheck->setChecked( composer.readEntry( "word-wrap", false ) );
if ( composer.hasKey( "break-at" ) )
mWrapColumnSpin->setValue( composer.readEntry( "break-at", 0 ) );
#ifdef ENTERPRISE_BUILD
if ( composer.hasKey( "too-many-recipients" ) )
mRecipientCheck->setChecked( composer.readEntry( "too-many-recipients", false ) );
if ( composer.hasKey( "recipient-threshold" ) )
mRecipientSpin->setValue( composer.readEntry( "recipient-threshold", 5 ) );
#endif
if ( composer.hasKey( "autosave" ) )
mAutoSave->setValue( composer.readEntry( "autosave", 0 ) );
@ -3052,10 +3065,13 @@ void ComposerPage::GeneralTab::save() {
GlobalSettings::self()->setRequestMDN( mAutoRequestMDNCheck->isChecked() );
GlobalSettings::self()->setWordWrap( mWordWrapCheck->isChecked() );
GlobalSettings::self()->setLineWrapWidth( mWrapColumnSpin->value() );
GlobalSettings::self()->setAutosaveInterval( mAutoSave->value() );
#ifdef ENTERPRISE_BUILD
GlobalSettings::self()->setTooManyRecipients( mRecipientCheck->isChecked() );
GlobalSettings::self()->setRecipientThreshold( mRecipientSpin->value() );
GlobalSettings::self()->setAutosaveInterval( mAutoSave->value() );
GlobalSettings::self()->setForwardingInlineByDefault( mForwardTypeCombo->currentIndex() == 0 );
#endif
// editor group:
GlobalSettings::self()->setUseExternalEditor( mExternalEditorCheck->isChecked() );

@ -5,6 +5,8 @@
#ifndef _CONFIGURE_DIALOG_PRIVATE_H_
#define _CONFIGURE_DIALOG_PRIVATE_H_
#include <config-enterprise.h>
#include "kmail_export.h"
#include <QPointer>
@ -667,12 +669,14 @@ private:
QCheckBox *mShowRecentAddressesInComposer;
QCheckBox *mWordWrapCheck;
KIntSpinBox *mWrapColumnSpin;
QCheckBox *mRecipientCheck;
KIntSpinBox *mRecipientSpin;
KIntSpinBox *mAutoSave;
QCheckBox *mExternalEditorCheck;
KUrlRequester *mEditorRequester;
#ifdef ENTERPRISE_BUILD
KComboBox *mForwardTypeCombo;
QCheckBox *mRecipientCheck;
KIntSpinBox *mRecipientSpin;
#endif
};
class ComposerPageTemplatesTab : public ConfigModuleTab {

@ -335,7 +335,7 @@
</entry>
<entry name="TooManyRecipients" type="Bool" key="too-many-recipients">
<label>Warn if the number of recipients is larger than</label>
<default>true</default>
<default>${WARN_TOOMANY_RECIPIENTS_DEFAULT}</default>
<whatsthis>If the number of recipients is larger than this value, KMail will warn and ask for a confirmation before sending the mail. The warning can be turned off.</whatsthis>
</entry>
<entry name="RecipientThreshold" type="Int" key="recipient-threshold">
Loading…
Cancel
Save