summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
blob: 5680454f19770e024263730a3183e022eac349dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "viewmodebutton.h"

/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;

/* QT */
#include <qtoolbar.h>
#include <qpopupmenu.h>

ViewModeButton::ViewModeButton( QToolBar* bar,int def )
    : QToolButton( bar )
{
    slotChange( def );
    QPopupMenu *pop= new QPopupMenu( this );
    pop->setCheckable( true );
    pop->insertItem( tr("Thumbnail and Imageinfo"), 1 );
    pop->insertItem( tr("Thumbnail and Name" ), 2 );
    pop->insertItem( tr("Name Only" ), 3 );
    connect(pop, SIGNAL(activated(int)),
            this, SIGNAL(changeMode(int)) );
    connect(pop, SIGNAL(activated(int)),
            this, SLOT(slotChange(int)) );


    setPopup( pop );
}

ViewModeButton::~ViewModeButton() {
}

void ViewModeButton::slotChange( int i ) {
    QString name;
    switch( i ) {
    case 1:
        name = "opie-eye/opie-eye-thumb";
        break;
    case 2:
        name = "opie-eye/opie-eye-thumbonly";
        break;
    case 3:
        name = "opie-eye/opie-eye-textview";
        break;
    }

    owarn << "foo " << name << oendl;
    setIconSet( Opie::Core::OResource::loadPixmap( name, Opie::Core::OResource::SmallIcon ) );
}