author | harlekin <harlekin> | 2004-06-19 10:18:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-06-19 10:18:25 (UTC) |
commit | e05195bbaf71fbfca033bef5855085772fa586eb (patch) (side-by-side diff) | |
tree | 2e2aaf7a200ac7f4c2e4a8a76f62fb1ed2f5e590 | |
parent | 48ec0fc077b7834c49c1af1b1279f943ef58de41 (diff) | |
download | opie-e05195bbaf71fbfca033bef5855085772fa586eb.zip opie-e05195bbaf71fbfca033bef5855085772fa586eb.tar.gz opie-e05195bbaf71fbfca033bef5855085772fa586eb.tar.bz2 |
BUGFIX: 0001089 - remember Browse path when selecting a tab background image
-rw-r--r-- | core/settings/launcher/tabconfig.h | 13 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 18 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 6 |
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 @@ -14,9 +14,9 @@ : .. .:, . . . 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., @@ -27,9 +27,9 @@ #ifndef __TABCONFIG_H__ #define __TABCONFIG_H__ struct TabConfig { - enum ViewMode { + enum ViewMode { Icon, List }; enum BackgroundType { @@ -39,8 +39,9 @@ struct TabConfig { }; 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; @@ -48,24 +49,24 @@ struct TabConfig { 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 @@ -27,22 +27,27 @@ #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> @@ -413,11 +418,8 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) 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 ); @@ -427,8 +429,12 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) 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; } @@ -479,10 +485,12 @@ void TabDialog::bgImageClicked ( ) 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 ); } } 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 @@ -142,13 +142,15 @@ void TabsSettings::readTabSettings ( Config &cfg ) 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; @@ -163,8 +165,9 @@ void TabsSettings::readTabSettings ( Config &cfg ) 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 ) { @@ -199,8 +202,9 @@ void TabsSettings::readTabSettings ( Config &cfg ) void TabsSettings::accept ( ) { Config cfg ( "Launcher" ); + Config cfg2 ( "Launchersettings" ); // Launcher Tab QString grp ( "Tab %1" ); // No tr @@ -210,8 +214,9 @@ void TabsSettings::accept ( ) 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; @@ -225,8 +230,9 @@ void TabsSettings::accept ( ) 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 ); |