karbon

vselectiondesc.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, The Karbon Developers
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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "vselectiondesc.h"
00021 #include "vselection.h"
00022 #include "vgroup.h"
00023 #include "vtext.h"
00024 #include "vimage.h"
00025 #include "vcomposite.h"
00026 #include <kdebug.h>
00027 #include <klocale.h>
00028 
00029 void
00030 VSelectionDescription::visitVSelection( VSelection& selection )
00031 {
00032     if( selection.objects().count() == 1 )
00033         VVisitor::visitVSelection( selection );
00034     else
00035         m_desc = i18n( "One object", "%n objects", selection.objects().count() );
00036 }
00037 
00038 void
00039 VSelectionDescription::visitVPath( VPath& composite )
00040 {
00041     m_desc = m_shortdesc = !composite.name().isEmpty() ? composite.name() : i18n( "path" );
00042 }
00043 
00044 void
00045 VSelectionDescription::visitVGroup( VGroup &group )
00046 {
00047     m_desc = i18n( "One group, containing one object", "One group, containing %n objects", group.objects().count() );
00048     m_shortdesc = !group.name().isEmpty() ? group.name() : i18n( "group" );
00049 }
00050 
00051 void
00052 VSelectionDescription::visitVText( VText &text )
00053 {
00054     m_desc = m_shortdesc = !text.name().isEmpty() ? text.name() : i18n( "text" );
00055 }
00056 
00057 void
00058 VSelectionDescription::visitVImage( VImage &img )
00059 {
00060     m_desc = m_shortdesc = !img.name().isEmpty() ? img.name() : i18n( "image" );
00061 }
00062 
KDE Home | KDE Accessibility Home | Description of Access Keys