summaryrefslogtreecommitdiff
path: root/core/settings/launcher/tabdialog.cpp
Side-by-side diff
Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabdialog.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index 546e229..cef92d9 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -7,62 +7,67 @@
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . 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.
*/
#include "tabdialog.h"
/* OPIE */
-#include <qpe/resource.h>
+
#include <opie2/ofontselector.h>
#include <opie2/otabwidget.h>
#include <opie2/ocolorbutton.h>
#include <opie2/ofiledialog.h>
#include <opie2/odebug.h>
+/* QPE */
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
/* QT */
#include <qlayout.h>
#include <qvbox.h>
#include <qtabbar.h>
#include <qiconview.h>
#include <qapplication.h>
#include <qlabel.h>
+#include <qfileinfo.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qwhatsthis.h>
#include <qcheckbox.h>
using namespace Opie::Ui;
class SampleItem : public QIconViewItem {
public:
SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
{
m_large = pix;
m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
}
void sizeChange ( )
{
calcRect ( );
repaint ( );
}
QPixmap *pixmap ( ) const
{
if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
@@ -393,62 +398,63 @@ QWidget *TabDialog::createIconTab ( QWidget *parent )
{
QWidget *tab = new QWidget( parent, "IconTab" );
QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
QGridLayout* gridLayout = new QGridLayout ( vertLayout );
gridLayout-> setColStretch ( 1, 10 );
QLabel* label = new QLabel( tr( "Size:" ), tab );
gridLayout-> addWidget ( label, 0, 0 );
m_iconsize = new QButtonGroup( tab, "buttongroup" );
m_iconsize-> hide ( );
m_iconsize-> setExclusive ( true );
QRadioButton *rb;
rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
m_iconsize-> insert ( rb, TabConfig::List );
gridLayout-> addWidget( rb, 0, 1 );
rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
m_iconsize-> insert ( rb, TabConfig::Icon );
gridLayout-> addWidget( rb, 1, 1 );
connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
-// vertLayout-> addSpacing ( 8 );
-
-// gridLayout = new QGridLayout ( vertLayout );
gridLayout-> addRowSpacing ( 2, 8 );
label = new QLabel ( tr( "Color:" ), tab );
gridLayout-> addWidget ( label, 3, 0 );
m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) );
connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
vertLayout-> addStretch ( 10 );
+ if ( m_tc.m_last_directory == QString::null ) {
+ m_tc.m_last_directory = QPEApplication::documentDir();
+ }
+
return tab;
}
void TabDialog::iconSizeClicked ( int s )
{
m_sample-> setViewMode ((TabConfig::ViewMode) s );
}
void TabDialog::fontClicked ( const QFont &f )
{
m_sample-> setViewFont ( f );
}
void TabDialog::bgTypeClicked ( int t )
{
QString s;
if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
m_bgtype-> setButton ( t );
m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
m_imagebrowse-> setEnabled ( t == TabConfig::Image );
@@ -459,50 +465,52 @@ void TabDialog::bgTypeClicked ( int t )
m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
}
void TabDialog::bgColorClicked ( const QColor & )
{
bgTypeClicked ( TabConfig::SolidColor );
}
void TabDialog::iconColorClicked ( const QColor &col )
{
m_sample-> setTextColor ( col );
}
void TabDialog::bgImageClicked ( )
{
// ### use OFileSelector here ###
// this is just a quick c&p from the old appearance app
MimeTypes types;
QStringList list;
list << "image/*";
types. insert ( "Images", list );
- QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types );
+ QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types );
+
if ( !file. isEmpty ( )) {
+ m_tc.m_last_directory = QFileInfo( file ).dirPath();
m_bgimage = DocLnk ( file ). file ( );
bgTypeClicked ( TabConfig::Image );
}
}
void TabDialog::bgDefaultClicked ( )
{
m_bgimage = "launcher/opie-background";
bgTypeClicked ( TabConfig::Image );
}
void TabDialog::accept ( )
{
m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
m_tc. m_bg_image = m_bgimage;
m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
m_tc. m_font_use = m_fontuse-> isChecked ( );
if ( m_tc. m_font_use ) {
QFont f = m_fontselect-> selectedFont ( );