klistviewaction.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #if defined(KDE_IS_VERSION)
00020 # if KDE_IS_VERSION(3,1,3)
00021 # ifndef _KDE_3_1_3_
00022 # define _KDE_3_1_3_
00023 # endif
00024 # endif
00025 #endif
00026 #include "klistviewaction.h"
00027 #include "kcomboview.h"
00028 #include "resizablecombo.h"
00029
00030 #include <qtooltip.h>
00031 #include <qwhatsthis.h>
00032
00033 #include <kconfig.h>
00034 #include <kglobal.h>
00035
00036 KListViewAction::~KListViewAction()
00037 {
00038 KConfig *config = KGlobal::config();
00039 if (config && m_view->name())
00040 {
00041 config->setGroup("KListViewAction");
00042 config->writeEntry(m_view->name(), m_view->width());
00043 }
00044 delete m_view;
00045 }
00046
00047 KListViewAction::KListViewAction(KComboView *view, const QString & text, const KShortcut & cut,
00048 const QObject * receiver, const char * slot, KActionCollection * parent, const char * name ):
00049 KWidgetAction(view, text, cut, receiver, slot, parent, name), m_view(view)
00050 {
00051 m_view->setDuplicatesEnabled(false);
00052 m_view->setInsertionPolicy(KComboView::NoInsertion);
00053
00054 loadComboWidth();
00055 }
00056
00057 KListViewAction::KListViewAction( KComboView * view, const QString & text, const KShortcut & cut,
00058 const QObject * receiver, const char * slot, KActionCollection * parent, const char * name, const bool ):
00059 KWidgetAction(new ResizableCombo(view), text, cut, receiver, slot, parent, name), m_view(view)
00060 {
00061 m_view->setDuplicatesEnabled(false);
00062 m_view->setInsertionPolicy(KComboView::NoInsertion);
00063
00064 loadComboWidth();
00065 }
00066
00067 KComboView * KListViewAction::view( ) const
00068 {
00069 return m_view;
00070 }
00071
00072 void KListViewAction::setToolTip( const QString & str )
00073 {
00074 QToolTip::remove(m_view);
00075 QToolTip::add(m_view, str);
00076 }
00077
00078 void KListViewAction::setWhatsThis( const QString & str )
00079 {
00080 QWhatsThis::remove(m_view);
00081 QWhatsThis::add(m_view, str);
00082 }
00083
00084 void KListViewAction::loadComboWidth( )
00085 {
00086 KConfig *config = KGlobal::config();
00087 if (config && m_view->name())
00088 {
00089 config->setGroup("KListViewAction");
00090 m_view->setMinimumWidth(config->readNumEntry(m_view->name(), m_view->defaultWidth()));
00091 }
00092 }
00093
This file is part of the documentation for KDevelop Version 3.1.2.