00001 #include "viewmodebutton.h"
00002
00003
00004 #include <opie2/odebug.h>
00005 using namespace Opie::Core;
00006
00007
00008 #include <qtoolbar.h>
00009 #include <qpopupmenu.h>
00010
00011 ViewModeButton::ViewModeButton( QToolBar* bar,int def )
00012 : QToolButton( bar )
00013 {
00014 slotChange( def );
00015 QPopupMenu *pop= new QPopupMenu( this );
00016 pop->setCheckable( true );
00017 pop->insertItem( tr("Thumbnail and Imageinfo"), 1 );
00018 pop->insertItem( tr("Thumbnail and Name" ), 2 );
00019 pop->insertItem( tr("Name Only" ), 3 );
00020 connect(pop, SIGNAL(activated(int)),
00021 this, SIGNAL(changeMode(int)) );
00022 connect(pop, SIGNAL(activated(int)),
00023 this, SLOT(slotChange(int)) );
00024
00025
00026 setPopup( pop );
00027 }
00028
00029 ViewModeButton::~ViewModeButton() {
00030 }
00031
00032 void ViewModeButton::slotChange( int i ) {
00033 QString name;
00034 switch( i ) {
00035 case 1:
00036 name = "opie-eye/opie-eye-thumb";
00037 break;
00038 case 2:
00039 name = "opie-eye/opie-eye-thumbonly";
00040 break;
00041 case 3:
00042 name = "opie-eye/opie-eye-textview";
00043 break;
00044 }
00045
00046 owarn << "foo " << name << oendl;
00047 setIconSet( Opie::Core::OResource::loadPixmap( name, Opie::Core::OResource::SmallIcon ) );
00048 }