summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h13
-rw-r--r--core/settings/launcher/tabdialog.cpp18
-rw-r--r--core/settings/launcher/tabssettings.cpp6
3 files changed, 26 insertions, 11 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 9086341..84ba073 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -12,60 +12,61 @@
    .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.
*/
#ifndef __TABCONFIG_H__
#define __TABCONFIG_H__
struct TabConfig {
- enum ViewMode {
+ enum ViewMode {
Icon,
List
};
enum BackgroundType {
Ruled,
SolidColor,
Image
};
ViewMode m_view;
BackgroundType m_bg_type;
+ QString m_last_directory;
QString m_bg_image;
QString m_bg_color;
QString m_text_color;
bool m_font_use;
QString m_font_family;
int m_font_size;
int m_font_weight;
bool m_font_italic;
bool m_changed;
-
+
bool operator == ( const TabConfig &tc )
{
- return ( m_view == tc. m_view ) &&
+ return ( m_view == tc. m_view ) &&
( m_bg_type == tc. m_bg_type ) &&
( m_bg_image == tc. m_bg_image ) &&
( m_bg_color == tc. m_bg_color ) &&
( m_text_color == tc. m_text_color ) &&
- ( m_font_use == tc. m_font_use ) &&
+ ( m_font_use == tc. m_font_use ) &&
( m_font_use ? (
( m_font_family == tc. m_font_family ) &&
( m_font_size == tc. m_font_size ) &&
( m_font_weight == tc. m_font_weight ) &&
( m_font_italic == tc. m_font_italic )
) : true );
-
+
}
};
#endif
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
@@ -25,26 +25,31 @@
*/
#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>
@@ -411,26 +416,27 @@ QWidget *TabDialog::createIconTab ( QWidget *parent )
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 )
{
@@ -477,14 +483,16 @@ void TabDialog::bgImageClicked ( )
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 ( )
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index e5a7087..5ac625b 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -140,17 +140,19 @@ void TabsSettings::readTabSettings ( Config &cfg )
global_def. m_font_family = font ( ). family ( );
global_def. m_font_size = font ( ). pointSize ( );
global_def. m_font_weight = 50;
global_def. m_font_italic = false;
global_def. m_changed = false;
+ Config cfg2 = Config( "Launchersettings" );
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
cfg. setGroup ( grp. arg ( *it ));
+ cfg2. setGroup( grp. arg ( *it ));
QString view = cfg. readEntry ( "View" );
if ( view == "Icon" ) // No tr
tc. m_view = TabConfig::Icon;
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
@@ -161,12 +163,13 @@ void TabsSettings::readTabSettings ( Config &cfg )
else if ( bgType == "SolidColor" )
tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
tc. m_bg_type = TabConfig::Image;
tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
+ tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" );
tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
tc. m_font_use = true;
tc. m_font_family = f [0];
@@ -197,23 +200,25 @@ void TabsSettings::readTabSettings ( Config &cfg )
}
void TabsSettings::accept ( )
{
Config cfg ( "Launcher" );
+ Config cfg2 ( "Launchersettings" );
// Launcher Tab
QString grp ( "Tab %1" ); // No tr
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig &tc = m_tabs [*it];
if ( !tc. m_changed )
continue;
cfg. setGroup ( grp. arg ( *it ));
+ cfg2. setGroup ( grp. arg ( *it ));
switch ( tc. m_view ) {
case TabConfig::Icon:
cfg.writeEntry ( "View", "Icon" );
break;
case TabConfig::List:
cfg.writeEntry ( "View", "List" );
@@ -223,12 +228,13 @@ void TabsSettings::accept ( )
QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
e << *it << tc. m_view;
cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
cfg. writeEntry ( "TextColor", tc. m_text_color );
+ cfg2. writeEntry ( "DefaultDir", tc.m_last_directory );
if ( tc. m_font_use ) {
QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
cfg. writeEntry ( "Font", f );
}
else