KDevelop API Documentation

klistviewaction.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
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 /*dummy*/ ):
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 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:36 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003