summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp8
-rw-r--r--noncore/settings/appearance2/exceptlistitem.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 22b12b4..f611799 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -265,84 +265,86 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab );
m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" ));
lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 );
QLabel *l = new QLabel ( tab );
l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" )));
lay-> addMultiCellWidget ( l, 1, 1, 0, 1 );
m_except = new QListView ( tab );
m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 );
m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 );
m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 );
m_except-> addColumn ( tr( "Binary file(s)" ));
m_except-> setColumnAlignment ( 0, AlignCenter );
m_except-> setColumnAlignment ( 1, AlignCenter );
m_except-> setColumnAlignment ( 2, AlignCenter );
m_except-> setAllColumnsShowFocus ( true );
m_except-> setMinimumHeight ( 30 );
m_except-> header ( )-> setClickEnabled ( false );
m_except-> header ( )-> setResizeEnabled ( false );
m_except-> header ( )-> setMovingEnabled ( false );
+ m_except-> setSorting ( -1 );
lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 );
connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int )));
QToolButton *tb = new QToolButton ( tab );
tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" ));
tb-> setFocusPolicy ( QWidget::StrongFocus );
lay-> addWidget ( tb, 2, 1 );
connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( )));
tb = new QToolButton ( tab );
tb-> setIconSet ( Resource::loadIconSet ( "editdelete" ));
tb-> setFocusPolicy ( QWidget::StrongFocus );
lay-> addWidget ( tb, 3, 1 );
connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( )));
tb = new QToolButton ( tab );
tb-> setIconSet ( Resource::loadIconSet ( "up" ));
tb-> setFocusPolicy ( QWidget::StrongFocus );
lay-> addWidget ( tb, 4, 1 );
connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( )));
tb = new QToolButton ( tab );
tb-> setIconSet ( Resource::loadIconSet ( "down" ));
tb-> setFocusPolicy ( QWidget::StrongFocus );
lay-> addWidget ( tb, 5, 1 );
connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( )));
lay-> setRowStretch ( 6, 10 );
lay-> setColStretch ( 0, 10 );
QStringList sl = cfg. readListEntry ( "NoStyle", ';' );
+ QListViewItem *lvit = 0;
for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
int fl = ( *it ). left ( 1 ). toInt ( 0, 32 );
- new ExceptListItem ( m_except, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
+ lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 );
}
vertLayout-> addSpacing ( 3 );
QFrame *f = new QFrame ( tab );
f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken );
vertLayout-> addWidget ( f );
vertLayout-> addSpacing ( 3 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 );
int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1;
bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" );
QLabel* label = new QLabel( tr( "Tab style:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
btngrp-> hide ( );
btngrp-> setExclusive ( true );
m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
m_tabstyle_list-> insertItem ( tr( "Tabs" ));
m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
@@ -434,48 +436,50 @@ void Appearance::accept ( )
config.writeEntry( "Decoration", item-> key ( ));
}
if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
config. writeEntry ( "TabStyle", newtabstyle + 1 );
config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
}
if ( m_font_changed ) {
config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
}
if ( m_color_changed )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( item )
item-> save ( config );
}
+ m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated
+
QStringList sl;
for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) {
int fl = 0;
fl |= ( it-> noStyle ( ) ? 0x01 : 0 );
fl |= ( it-> noFont ( ) ? 0x02 : 0 );
fl |= ( it-> noDeco ( ) ? 0x04 : 0 );
sl << ( QString::number ( fl, 32 ) + it-> pattern ( ));
}
config. writeEntry ( "NoStyle", sl, ';' );
config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
config. write ( ); // need to flush the config info first
Global::applyStyle ( );
if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
QCopEnvelope e( "QPE/System", "restart()" );
}
QDialog::accept ( );
}
void Appearance::done ( int r )
{
QDialog::done ( r );
@@ -631,49 +635,49 @@ void Appearance::saveSchemeClicked()
void Appearance::deleteSchemeClicked()
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( !item )
return;
if ( m_color_list-> currentItem ( ) > 0 )
{
if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?",
tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" );
delete item;
}
}
else
{
QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
}
}
void Appearance::addExcept ( )
{
- ExceptListItem *it = new ExceptListItem ( m_except, tr( "<new>" ), true, true, true );
+ ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true );
m_except-> ensureItemVisible ( it );
m_except-> setSelected ( it, true );
}
void Appearance::delExcept ( )
{
if ( m_except-> selectedItem ( )) {
m_except-> setFocus ( );
delete m_except-> selectedItem ( );
}
}
void Appearance::upExcept ( )
{
ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
if ( it && it-> itemAbove ( ))
it-> itemAbove ( )-> moveItem ( it );
}
void Appearance::downExcept ( )
{
ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( );
diff --git a/noncore/settings/appearance2/exceptlistitem.h b/noncore/settings/appearance2/exceptlistitem.h
index 5eda79c..7b4fa48 100644
--- a/noncore/settings/appearance2/exceptlistitem.h
+++ b/noncore/settings/appearance2/exceptlistitem.h
@@ -14,49 +14,49 @@
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef EXCEPTLISTITEM_H
#define EXCEPTLISTITEM_H
#include <qlistview.h>
#include <qpixmap.h>
#include <qimage.h>
#include <qpainter.h>
class ExceptListItem : public QListViewItem {
public:
- ExceptListItem ( QListView *lv, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv )
+ ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after )
{
m_text = t;
m_nofont = nofont;
m_nostyle = nostyle;
m_nodeco = nodeco;
init ( );
}
virtual ~ExceptListItem ( )
{
}
static void overlay ( QImage &img, const QImage &ovl )
{
if (( img. size ( ) != ovl. size ( )) ||
( img. depth ( ) != ovl. depth ( )))
return;
for ( int y = 0; y != img. height ( ); y++ ) {
QRgb *iline = (QRgb *) img. scanLine ( y );
QRgb *oline = (QRgb *) ovl. scanLine ( y );