File: appearance.cpp

package info (click to toggle)
kascade 1.0-beta10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 964 kB
  • ctags: 815
  • sloc: cpp: 7,780; makefile: 39
file content (135 lines) | stat: -rw-r--r-- 4,149 bytes parent folder | download
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/***************************************************************************
                          appearance.cpp  -  description
                             -------------------
    begin                : Tue Feb 8 2000
    copyright            : (C) 2000 by mark dufour
    email                : m.dufour@twi.tudelft.nl
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include "appearance.h"
#include "globals.h"
#include "browser.h"

#include <qmenubar.h>
#include <qtoolbar.h>
#include <qstatusbar.h>
#include <qmessagebox.h>
#include <qfiledialog.h>
#include <qstring.h>

appearance::appearance(QWidget *parent, const char *name) : QWidget(parent,name){
	initDialog();
}

void appearance::connect()
{
	QObject::connect( CBuppertoolbar, SIGNAL( toggled( bool ) ), this, SLOT( maintoolbarswitch( bool ) ) );
	QObject::connect( CBstatusbar, SIGNAL( toggled( bool ) ), this, SLOT( statusbarswitch( bool ) ) );
	QObject::connect( LBavailable, SIGNAL( selected( const QString & ) ), this, SLOT( availableSelected( const QString & ) ) ); 
	QObject::connect( Bselect, SIGNAL( clicked() ), this, SLOT( selectButton() ) );
	QObject::connect( Bclear, SIGNAL( clicked() ), this, SLOT( clearButton() ) );
	QObject::connect( Bdelete, SIGNAL( clicked() ), this, SLOT( deleteButton() ) );
	QObject::connect( Bdefault, SIGNAL( clicked() ), this, SLOT( defaultButton() ) );
	QObject::connect( Biconsetdir, SIGNAL( clicked() ), this, SLOT( iconsetButton() ) );
	QObject::connect( LEiconsetdir, SIGNAL( textChanged( const QString & ) ), this, SLOT( iconsetdirChanged( const QString & ) ) );
	QObject::connect( CBenableediting, SIGNAL( toggled( bool ) ), this, SLOT( enableeditingswitch( bool ) ) ); 
}

appearance::~appearance(){
}

void appearance::iconsetButton()
{
	QString dir = QFileDialog::getExistingDirectory();

	if( dir != QString::null )
		LEiconsetdir->setText( dir );
}

void appearance::iconsetdirChanged( const QString & )
{
	//browser->renewToolbar(); // keertje terug zetten
}

void appearance::selectButton()
{
	if( LBavailable->currentItem() != -1 )
			availableSelected( LBavailable->currentText() );
}

void appearance::clearButton()
{
	LBselected->clear();
	browser->renewToolbar();
}

void appearance::deleteButton()
{
	if( LBselected->currentItem() != -1 )
	{
		LBselected->removeItem( LBselected->currentItem() );
		browser->renewToolbar();
	}	
}

void appearance::defaultButton()
{
	defaultSelected();
	browser->renewToolbar();
}

void appearance::defaultSelected()
{
	LBselected->clear();

  	LBselected->insertItem("back");
  	LBselected->insertItem("information");
  	LBselected->insertItem("chat");
  	LBselected->insertItem("links");
  	LBselected->insertItem("new search");
}

void appearance::availableSelected( const QString &item )
{
	if( LBselected->findItem( item ) )
	{
		LBselected->removeItem( LBselected->index( LBselected->findItem( item ) ) );
		LBselected->insertItem( item, LBselected->currentItem()+1 );
	}
	else
		LBselected->insertItem( item );

	browser->renewToolbar();
}

void appearance::maintoolbarswitch( bool on )
{
	if( on )
		browser->toolBar->show();
	else
		browser->toolBar->hide();
}

void appearance::enableeditingswitch( bool on )
{
	if( on )
		browser->editmenuid = browser->mainmenu->insertItem( "&Editing Options", browser->editmenu, CTRL+Key_E, 3 );
	else
		browser->mainmenu->removeItem( browser->editmenuid ); 
}

void appearance::statusbarswitch( bool on )
{
	if( on )
		browser->statusBar()->show();
	else
		browser->statusBar()->hide();
}