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 @@ -15,7 +15,7 @@ =_ + =;=|` 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 @@ -28,7 +28,7 @@ #define __TABCONFIG_H__ struct TabConfig { - enum ViewMode { + enum ViewMode { Icon, List }; @@ -40,6 +40,7 @@ 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; @@ -49,22 +50,22 @@ struct TabConfig { 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 ); - + } }; 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 @@ -28,13 +28,17 @@ #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> @@ -42,6 +46,7 @@ #include <qiconview.h> #include <qapplication.h> #include <qlabel.h> +#include <qfileinfo.h> #include <qradiobutton.h> #include <qbuttongroup.h> #include <qwhatsthis.h> @@ -414,9 +419,6 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) 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 ); @@ -428,6 +430,10 @@ QWidget *TabDialog::createIconTab ( QWidget *parent ) vertLayout-> addStretch ( 10 ); + if ( m_tc.m_last_directory == QString::null ) { + m_tc.m_last_directory = QPEApplication::documentDir(); + } + return tab; } @@ -480,8 +486,10 @@ void TabDialog::bgImageClicked ( ) 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 @@ -143,11 +143,13 @@ void TabsSettings::readTabSettings ( Config &cfg ) 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 @@ -164,6 +166,7 @@ void TabsSettings::readTabSettings ( Config &cfg ) 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", ',' ); @@ -200,6 +203,7 @@ void TabsSettings::readTabSettings ( Config &cfg ) void TabsSettings::accept ( ) { Config cfg ( "Launcher" ); + Config cfg2 ( "Launchersettings" ); // Launcher Tab QString grp ( "Tab %1" ); // No tr @@ -211,6 +215,7 @@ void TabsSettings::accept ( ) continue; cfg. setGroup ( grp. arg ( *it )); + cfg2. setGroup ( grp. arg ( *it )); switch ( tc. m_view ) { case TabConfig::Icon: cfg.writeEntry ( "View", "Icon" ); @@ -226,6 +231,7 @@ 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" ); |