summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-11 17:03:59 (UTC)
committer zautrix <zautrix>2005-06-11 17:03:59 (UTC)
commit81370a5f955c2710b6e9336b6c412c8d630ef72a (patch) (unidiff)
tree6252851fbafcbc3ff777e1af0171990124beb23e
parent0cfaf22fc5d8f511320813171be84ce3436990c6 (diff)
downloadkdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.zip
kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.gz
kdepimpi-81370a5f955c2710b6e9336b6c412c8d630ef72a.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp11
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp2
-rw-r--r--microkde/kfiledialog.cpp11
-rw-r--r--microkde/kfiledialog.h2
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp7
-rw-r--r--microkde/kio/kfile/kurlrequester.h2
6 files changed, 30 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 4b82aa8..8f5de4d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -599,99 +599,101 @@ void CalendarView::init()
599 599
600 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 600 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
601 601
602 mEventEditor = mDialogManager->getEventEditor(); 602 mEventEditor = mDialogManager->getEventEditor();
603 mTodoEditor = mDialogManager->getTodoEditor(); 603 mTodoEditor = mDialogManager->getTodoEditor();
604 604
605 mFlagEditDescription = false; 605 mFlagEditDescription = false;
606 606
607 mSuspendTimer = new QTimer( this ); 607 mSuspendTimer = new QTimer( this );
608 mAlarmTimer = new QTimer( this ); 608 mAlarmTimer = new QTimer( this );
609 mRecheckAlarmTimer = new QTimer( this ); 609 mRecheckAlarmTimer = new QTimer( this );
610 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 610 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
611 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 611 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
612 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 612 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
613 mAlarmDialog = new AlarmDialog( this ); 613 mAlarmDialog = new AlarmDialog( this );
614 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 614 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
615 mAlarmDialog->setServerNotification( false ); 615 mAlarmDialog->setServerNotification( false );
616 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 616 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
617 617
618 618
619#ifndef DESKTOP_VERSION 619#ifndef DESKTOP_VERSION
620//US listen for arriving address resultsets 620//US listen for arriving address resultsets
621 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 621 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
622 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 622 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
623#endif 623#endif
624 mDateNavigator->setCalendar( mCalendar ); 624 mDateNavigator->setCalendar( mCalendar );
625} 625}
626 626
627 627
628CalendarView::~CalendarView() 628CalendarView::~CalendarView()
629{ 629{
630 // kdDebug() << "~CalendarView()" << endl; 630 // kdDebug() << "~CalendarView()" << endl;
631 //qDebug("CalendarView::~CalendarView() "); 631 //qDebug("CalendarView::~CalendarView() ");
632 delete mDialogManager; 632 delete mDialogManager;
633 delete mViewManager; 633 delete mViewManager;
634 delete mStorage; 634 delete mStorage;
635 delete mDateFrame ; 635 delete mDateFrame ;
636 delete beamDialog; 636 delete beamDialog;
637 delete mEventViewerDialog; 637 delete mEventViewerDialog;
638 //kdDebug() << "~CalendarView() done" << endl; 638 //kdDebug() << "~CalendarView() done" << endl;
639} 639}
640void CalendarView::checkAlarms() 640void CalendarView::checkAlarms()
641{ 641{
642 KConfig *config = KOGlobals::config(); 642 KConfig *config = KOGlobals::config();
643 config->setGroup( "AppRun" ); 643 config->setGroup( "AppRun" );
644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 644 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
645 int secto = dt.secsTo( QDateTime::currentDateTime() ); 645 int secto = dt.secsTo( QDateTime::currentDateTime() );
646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; 646 int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30;
647 qDebug("KO: Reading program stop %d ", secs);
647 //secs -= ( 3600 * 24*3 ); // debug only 648 //secs -= ( 3600 * 24*3 ); // debug only
648 QDateTime latest = dt.addSecs ( secs ); 649 QDateTime latest = dt.addSecs ( secs );
649 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 650 qDebug("KO: Last termination on %s ", latest.toString().latin1());
651 qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
650 QPtrList<Incidence> el = mCalendar->rawIncidences(); 652 QPtrList<Incidence> el = mCalendar->rawIncidences();
651 QPtrList<Incidence> al; 653 QPtrList<Incidence> al;
652 Incidence* inL = el.first(); 654 Incidence* inL = el.first();
653 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 655 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
654 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 656 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
655 while ( inL ) { 657 while ( inL ) {
656 bool ok = false; 658 bool ok = false;
657 int offset = 0; 659 int offset = 0;
658 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 660 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
659 if ( ok ) { 661 if ( ok ) {
660 //qDebug("OK %s",next.toString().latin1()); 662 //qDebug("OK %s",next.toString().latin1());
661 if ( next < cur ) { 663 if ( next < cur ) {
662 al.append( inL ); 664 al.append( inL );
663 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 665 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
664 } 666 }
665 } 667 }
666 inL = el.next(); 668 inL = el.next();
667 } 669 }
668 if ( al.count() ) { 670 if ( al.count() ) {
669 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 671 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
670 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 672 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
671 QVBoxLayout* lay = new QVBoxLayout( dia ); 673 QVBoxLayout* lay = new QVBoxLayout( dia );
672 lay->setSpacing( 0 ); 674 lay->setSpacing( 0 );
673 lay->setMargin( 0 ); 675 lay->setMargin( 0 );
674 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 676 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
675 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 677 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
676 lay->addWidget( matb ); 678 lay->addWidget( matb );
677 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 679 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
678 int wid = 210; 680 int wid = 210;
679 int x = QApplication::desktop()->width() - wid - 7; 681 int x = QApplication::desktop()->width() - wid - 7;
680 int y = QApplication::desktop()->height() - wid - 70; 682 int y = QApplication::desktop()->height() - wid - 70;
681 dia->setGeometry ( x,y,wid,wid); 683 dia->setGeometry ( x,y,wid,wid);
682 } else { 684 } else {
683 int si = 220; 685 int si = 220;
684 if ( QApplication::desktop()->width() > 470 ) 686 if ( QApplication::desktop()->width() > 470 )
685 si = 400; 687 si = 400;
686 dia->resize(si,si/2); 688 dia->resize(si,si/2);
687 } 689 }
688 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 690 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
689 dia->show(); 691 dia->show();
690 692
691 } 693 }
692} 694}
693void CalendarView::showDay( QDate d ) 695void CalendarView::showDay( QDate d )
694{ 696{
695 dateNavigator()->blockSignals( true ); 697 dateNavigator()->blockSignals( true );
696 dateNavigator()->selectDate( d ); 698 dateNavigator()->selectDate( d );
697 dateNavigator()->blockSignals( false ); 699 dateNavigator()->blockSignals( false );
@@ -2111,98 +2113,103 @@ void CalendarView::readSettings()
2111 sizes = config->readIntListEntry("Main Splitter Frame"); 2113 sizes = config->readIntListEntry("Main Splitter Frame");
2112 resetval = 0; 2114 resetval = 0;
2113 maxVal = 0; 2115 maxVal = 0;
2114 if (sizes.count() != 2) { 2116 if (sizes.count() != 2) {
2115 if ( !KOPrefs::instance()->mVerticalScreen ) { 2117 if ( !KOPrefs::instance()->mVerticalScreen ) {
2116 resetval = mDateNavigator->sizeHint().width()+2; 2118 resetval = mDateNavigator->sizeHint().width()+2;
2117 } else { 2119 } else {
2118 resetval = mDateNavigator->sizeHint().height()+2; 2120 resetval = mDateNavigator->sizeHint().height()+2;
2119 } 2121 }
2120 } 2122 }
2121 if ( resetval ) { 2123 if ( resetval ) {
2122 sizes.clear(); 2124 sizes.clear();
2123 if ( !KOPrefs::instance()->mVerticalScreen ) { 2125 if ( !KOPrefs::instance()->mVerticalScreen ) {
2124 maxVal = QApplication::desktop()->width() -10; 2126 maxVal = QApplication::desktop()->width() -10;
2125 } else { 2127 } else {
2126 maxVal = QApplication::desktop()->height()-10; 2128 maxVal = QApplication::desktop()->height()-10;
2127 } 2129 }
2128 sizes << resetval; 2130 sizes << resetval;
2129 if ( maxVal < resetval + resetval) 2131 if ( maxVal < resetval + resetval)
2130 resetval = maxVal - resetval; 2132 resetval = maxVal - resetval;
2131 sizes << resetval; 2133 sizes << resetval;
2132 } 2134 }
2133 mMainFrame->setSizes(sizes); 2135 mMainFrame->setSizes(sizes);
2134 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2136 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
2135 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2137 else if ( dateCount == 7 ) mNavigator->selectWeek();
2136 else mNavigator->selectDates( dateCount ); 2138 else mNavigator->selectDates( dateCount );
2137 // mViewManager->readSettings( config ); 2139 // mViewManager->readSettings( config );
2138 updateConfig(); 2140 updateConfig();
2139 globalFlagBlockAgenda = 2; 2141 globalFlagBlockAgenda = 2;
2140 mViewManager->readSettings( config ); 2142 mViewManager->readSettings( config );
2141 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2143 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
2142} 2144}
2143 2145
2144 2146
2145void CalendarView::writeSettings() 2147void CalendarView::writeSettings()
2146{ 2148{
2147 // kdDebug() << "CalendarView::writeSettings" << endl; 2149 // kdDebug() << "CalendarView::writeSettings" << endl;
2148 2150
2149 KConfig *config = KOGlobals::config(); 2151 KConfig *config = KOGlobals::config();
2150 2152
2151 mViewManager->writeSettings( config ); 2153 mViewManager->writeSettings( config );
2152 mTodoList->saveLayout(config,QString("Todo Layout")); 2154 mTodoList->saveLayout(config,QString("Todo Layout"));
2153 mDialogManager->writeSettings( config ); 2155 mDialogManager->writeSettings( config );
2154 //KOPrefs::instance()->usrWriteConfig(); 2156 //KOPrefs::instance()->usrWriteConfig();
2155 KOPrefs::instance()->writeConfig(); 2157 KOPrefs::instance()->writeConfig();
2156 2158
2157 writeFilterSettings(config); 2159 writeFilterSettings(config);
2158 config->setGroup( "AppRun" ); 2160 config->setGroup( "AppRun" );
2159 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2161 QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) );
2160 config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) ); 2162 int secs = dt.secsTo( QDateTime::currentDateTime() );
2163 config->writeEntry( "LatestProgramStop", secs );
2164 qDebug("KO: Writing stop time: %d ", secs);
2165 qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2166 QDateTime latest = dt.addSecs ( secs );
2167 qDebug("KO: Test termination on %s ", latest.toString().latin1());
2161 config->setGroup( "Views" ); 2168 config->setGroup( "Views" );
2162 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2169 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2163 2170
2164 QValueList<int> listINT = mLeftFrame->sizes(); 2171 QValueList<int> listINT = mLeftFrame->sizes();
2165 config->writeEntry("Left Splitter Frame",listINT); 2172 config->writeEntry("Left Splitter Frame",listINT);
2166 QValueList<int> listINT2 = mMainFrame->sizes(); 2173 QValueList<int> listINT2 = mMainFrame->sizes();
2167 config->writeEntry("Main Splitter Frame",listINT2); 2174 config->writeEntry("Main Splitter Frame",listINT2);
2168#ifdef DESKTOP_VERSION 2175#ifdef DESKTOP_VERSION
2169 config->setGroup("WidgetLayout"); 2176 config->setGroup("WidgetLayout");
2170 QStringList list ;//= config->readListEntry("MainLayout"); 2177 QStringList list ;//= config->readListEntry("MainLayout");
2171 int x,y,w,h; 2178 int x,y,w,h;
2172 QWidget* wid; 2179 QWidget* wid;
2173 wid = topLevelWidget(); 2180 wid = topLevelWidget();
2174 x = wid->geometry().x(); 2181 x = wid->geometry().x();
2175 y = wid->geometry().y(); 2182 y = wid->geometry().y();
2176 w = wid->width(); 2183 w = wid->width();
2177 h = wid->height(); 2184 h = wid->height();
2178 list.clear(); 2185 list.clear();
2179 list << QString::number( x ); 2186 list << QString::number( x );
2180 list << QString::number( y ); 2187 list << QString::number( y );
2181 list << QString::number( w ); 2188 list << QString::number( w );
2182 list << QString::number( h ); 2189 list << QString::number( h );
2183 config->writeEntry("MainLayout",list ); 2190 config->writeEntry("MainLayout",list );
2184 2191
2185 wid = mEventEditor; 2192 wid = mEventEditor;
2186 x = wid->geometry().x(); 2193 x = wid->geometry().x();
2187 y = wid->geometry().y(); 2194 y = wid->geometry().y();
2188 w = wid->width(); 2195 w = wid->width();
2189 h = wid->height(); 2196 h = wid->height();
2190 list.clear(); 2197 list.clear();
2191 list << QString::number( x ); 2198 list << QString::number( x );
2192 list << QString::number( y ); 2199 list << QString::number( y );
2193 list << QString::number( w ); 2200 list << QString::number( w );
2194 list << QString::number( h ); 2201 list << QString::number( h );
2195 config->writeEntry("EditEventLayout",list ); 2202 config->writeEntry("EditEventLayout",list );
2196 2203
2197 wid = mTodoEditor; 2204 wid = mTodoEditor;
2198 x = wid->geometry().x(); 2205 x = wid->geometry().x();
2199 y = wid->geometry().y(); 2206 y = wid->geometry().y();
2200 w = wid->width(); 2207 w = wid->width();
2201 h = wid->height(); 2208 h = wid->height();
2202 list.clear(); 2209 list.clear();
2203 list << QString::number( x ); 2210 list << QString::number( x );
2204 list << QString::number( y ); 2211 list << QString::number( y );
2205 list << QString::number( w ); 2212 list << QString::number( w );
2206 list << QString::number( h ); 2213 list << QString::number( h );
2207 config->writeEntry("EditTodoLayout",list ); 2214 config->writeEntry("EditTodoLayout",list );
2208 wid = getEventViewerDialog(); 2215 wid = getEventViewerDialog();
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index d3797ae..a0f9d2e 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -90,142 +90,144 @@ $Id$
90 90
91 91
92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
93 : KPrefsWidget(prefs, parent, name ) 93 : KPrefsWidget(prefs, parent, name )
94{ 94{
95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
101 101
102 102
103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
104 KDialog::spacingHint() ); 104 KDialog::spacingHint() );
105 105
106 tabWidget = new QTabWidget( this ); 106 tabWidget = new QTabWidget( this );
107 topLayout->addWidget( tabWidget ); 107 topLayout->addWidget( tabWidget );
108 108
109 109
110 setupLocaleTab(); 110 setupLocaleTab();
111 setupLocaleDateTab(); 111 setupLocaleDateTab();
112 setupTimeZoneTab(); 112 setupTimeZoneTab();
113 setupExternalAppTab(); 113 setupExternalAppTab();
114 setupStoreTab(); 114 setupStoreTab();
115 setupBackupTab(); 115 setupBackupTab();
116} 116}
117void KDEPIMConfigWidget::showTimeZoneTab() 117void KDEPIMConfigWidget::showTimeZoneTab()
118{ 118{
119 tabWidget->setCurrentPage ( 3 ) ; 119 tabWidget->setCurrentPage ( 3 ) ;
120} 120}
121void KDEPIMConfigWidget::setupBackupTab() 121void KDEPIMConfigWidget::setupBackupTab()
122{ 122{
123 QVBox *colorPage = new QVBox( this ); 123 QVBox *colorPage = new QVBox( this );
124 tabWidget->addTab( colorPage, i18n( "Backup" ) ); 124 tabWidget->addTab( colorPage, i18n( "Backup" ) );
125 QWidget* topFrame = new QWidget( colorPage ); 125 QWidget* topFrame = new QWidget( colorPage );
126 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 126 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
127 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), 127 KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
128 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); 128 &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
129 topLayout->addWidget((QWidget*)sb->checkBox()); 129 topLayout->addWidget((QWidget*)sb->checkBox());
130 QWidget* bupFrame = new QWidget( topFrame ); 130 QWidget* bupFrame = new QWidget( topFrame );
131 topLayout->addWidget((bupFrame)); 131 topLayout->addWidget((bupFrame));
132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); 132 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); 133 QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
134 sb = addWidBool(i18n("Use standard backup dir"), 134 sb = addWidBool(i18n("Use standard backup dir"),
135 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); 135 &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
136 bupLayout->addWidget((QWidget*)sb->checkBox()); 136 bupLayout->addWidget((QWidget*)sb->checkBox());
137 mBackupUrl = new KURLRequester( bupFrame ); 137 mBackupUrl = new KURLRequester( bupFrame );
138 mBackupUrl->setPathIsDir();
138 mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); 139 mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
139 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); 140 QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
140 bupLayout->addWidget( mBackupUrl ); 141 bupLayout->addWidget( mBackupUrl );
141 142
142 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); 143 mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
143 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); 144 bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
144 QHBox *dummy = new QHBox(bupFrame); 145 QHBox *dummy = new QHBox(bupFrame);
145 new QLabel(i18n("Number of Backups:"),dummy); 146 new QLabel(i18n("Number of Backups:"),dummy);
146 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); 147 mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
147 new QLabel(i18n(" "),dummy); 148 new QLabel(i18n(" "),dummy);
148 bupLayout->addWidget( dummy ); 149 bupLayout->addWidget( dummy );
149 150
150 dummy = new QHBox(bupFrame); 151 dummy = new QHBox(bupFrame);
151 new QLabel(i18n("Make backup every "),dummy); 152 new QLabel(i18n("Make backup every "),dummy);
152 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); 153 mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
153 new QLabel(i18n(" days"),dummy); 154 new QLabel(i18n(" days"),dummy);
154 new QLabel(i18n(" "),dummy); 155 new QLabel(i18n(" "),dummy);
155 bupLayout->addWidget( dummy ); 156 bupLayout->addWidget( dummy );
156 QString localKdeDir; 157 QString localKdeDir;
157 localKdeDir = readEnvPath("LOCALMICROKDEHOME"); 158 localKdeDir = readEnvPath("LOCALMICROKDEHOME");
158 if ( ! localKdeDir.isEmpty() ) { 159 if ( ! localKdeDir.isEmpty() ) {
159 sb->checkBox()->setEnabled( false ); 160 sb->checkBox()->setEnabled( false );
160 sb->checkBox()->setChecked( true ); 161 sb->checkBox()->setChecked( true );
161 mBackupUrl->setEnabled( false ); 162 mBackupUrl->setEnabled( false );
162 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; 163 KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
163 } 164 }
164 165
165} 166}
166void KDEPIMConfigWidget::setupStoreTab() 167void KDEPIMConfigWidget::setupStoreTab()
167{ 168{
168 QVBox *colorPage = new QVBox( this ); 169 QVBox *colorPage = new QVBox( this );
169 tabWidget->addTab( colorPage, i18n( "Colors" ) ); 170 tabWidget->addTab( colorPage, i18n( "Colors" ) );
170 QWidget* cw = new QWidget( colorPage ); 171 QWidget* cw = new QWidget( colorPage );
171 KPrefsWidColor *holidayColor = 172 KPrefsWidColor *holidayColor =
172 addWidColor(i18n("Alternating background of list views"), 173 addWidColor(i18n("Alternating background of list views"),
173 &(KPimGlobalPrefs::instance()->mAlternateColor),cw); 174 &(KPimGlobalPrefs::instance()->mAlternateColor),cw);
174 QHBoxLayout *topLayout = new QHBoxLayout(cw); 175 QHBoxLayout *topLayout = new QHBoxLayout(cw);
175 topLayout->addWidget(holidayColor->label()); 176 topLayout->addWidget(holidayColor->label());
176 topLayout->addWidget( (QWidget* )holidayColor->button()); 177 topLayout->addWidget( (QWidget* )holidayColor->button());
177 178
178 179
179 QVBox *storePage = new QVBox( this ); 180 QVBox *storePage = new QVBox( this );
180 if ( QApplication::desktop()->height() > 240 ) 181 if ( QApplication::desktop()->height() > 240 )
181 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); 182 new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
182 new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); 183 new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
183 mStoreUrl = new KURLRequester( storePage ); 184 mStoreUrl = new KURLRequester( storePage );
185 mStoreUrl->setPathIsDir();
184 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); 186 mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
185#ifdef DESKTOP_VERSION 187#ifdef DESKTOP_VERSION
186 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 188 QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
187 QFileInfo fi ( confFile ); 189 QFileInfo fi ( confFile );
188 if ( fi.exists() ) { 190 if ( fi.exists() ) {
189 KConfig cfg ( confFile ); 191 KConfig cfg ( confFile );
190 cfg.setGroup("Global"); 192 cfg.setGroup("Global");
191 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); 193 QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
192 if ( localKdeDir != "x_x_x" ) { 194 if ( localKdeDir != "x_x_x" ) {
193 mStoreUrl->setURL( localKdeDir ); 195 mStoreUrl->setURL( localKdeDir );
194 qDebug("Reading config from %s ", confFile.latin1()); 196 qDebug("Reading config from %s ", confFile.latin1());
195 } 197 }
196 } 198 }
197 199
198#endif 200#endif
199 new QLabel( i18n("New dirs are created automatically"), storePage ); 201 new QLabel( i18n("New dirs are created automatically"), storePage );
200 QHBox *bb = new QHBox( storePage ); 202 QHBox *bb = new QHBox( storePage );
201 QPushButton * pb; 203 QPushButton * pb;
202 if ( QApplication::desktop()->width() < 640 ) 204 if ( QApplication::desktop()->width() < 640 )
203 pb = new QPushButton ( i18n("Save"), bb ); 205 pb = new QPushButton ( i18n("Save"), bb );
204 else 206 else
205 pb = new QPushButton ( i18n("Save settings"), bb ); 207 pb = new QPushButton ( i18n("Save settings"), bb );
206 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); 208 connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
207 pb = new QPushButton ( i18n("Save standard"), bb ); 209 pb = new QPushButton ( i18n("Save standard"), bb );
208 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); 210 connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
209#ifdef DESKTOP_VERSION 211#ifdef DESKTOP_VERSION
210 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); 212 pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
211 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); 213 connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
212#endif 214#endif
213 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); 215 new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
214 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); 216 new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
215 tabWidget->addTab( storePage, i18n( "Data storage path" ) ); 217 tabWidget->addTab( storePage, i18n( "Data storage path" ) );
216} 218}
217void KDEPIMConfigWidget::setLocalStore() 219void KDEPIMConfigWidget::setLocalStore()
218{ 220{
219 mStoreUrl->setURL( "LOCAL:kdepimpi" ); 221 mStoreUrl->setURL( "LOCAL:kdepimpi" );
220 saveStoreSettings(); 222 saveStoreSettings();
221 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); 223 QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
222 KMessageBox::information( this, message); 224 KMessageBox::information( this, message);
223} 225}
224void KDEPIMConfigWidget::setStandardStore() 226void KDEPIMConfigWidget::setStandardStore()
225{ 227{
226 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); 228 mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
227 saveStoreSettings(); 229 saveStoreSettings();
228} 230}
229void KDEPIMConfigWidget::saveStoreSettings() 231void KDEPIMConfigWidget::saveStoreSettings()
230{ 232{
231 if ( !mStoreUrl->url().isEmpty() ) { 233 if ( !mStoreUrl->url().isEmpty() ) {
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 6be1580..c64f325 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -14,66 +14,75 @@ QString KFileDialog::getSaveFileName( const QString & fn,
14 QString retfile = ""; 14 QString retfile = "";
15 QDialog dia ( par, "input-dialog", true ); 15 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia ); 16 QVBoxLayout lay( &dia );
17 lay.setMargin(7); 17 lay.setMargin(7);
18 lay.setSpacing(7); 18 lay.setSpacing(7);
19 QString file = fn; 19 QString file = fn;
20 if ( file.isEmpty() ) 20 if ( file.isEmpty() )
21 file = QDir::homeDirPath()+"/*"; 21 file = QDir::homeDirPath()+"/*";
22 QFileInfo fi ( file ); 22 QFileInfo fi ( file );
23 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); 23 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
24 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); 24 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
25 lay.addWidget( &o); 25 lay.addWidget( &o);
26 // o.setNewVisible( true ); 26 // o.setNewVisible( true );
27 // o.setNameVisible( true ); 27 // o.setNameVisible( true );
28 dia.showMaximized(); 28 dia.showMaximized();
29 if ( cap.isEmpty() ) 29 if ( cap.isEmpty() )
30 dia.setCaption( file ); 30 dia.setCaption( file );
31 else 31 else
32 dia.setCaption( cap ); 32 dia.setCaption( cap );
33 int res = dia.exec(); 33 int res = dia.exec();
34 if ( res ) 34 if ( res )
35 retfile = o.selectedName(); 35 retfile = o.selectedName();
36 return retfile; 36 return retfile;
37} 37}
38 38
39QString KFileDialog::getOpenFileName( const QString & fn, 39QString KFileDialog::getOpenFileName( const QString & fn,
40 const QString & cap, QWidget * par ) 40 const QString & cap, QWidget * par )
41{ 41{
42 QString retfile = ""; 42 QString retfile = "";
43 QDialog dia ( par, "input-dialog", true ); 43 QDialog dia ( par, "input-dialog", true );
44 // QLineEdit lab ( &dia ); 44 // QLineEdit lab ( &dia );
45 QVBoxLayout lay( &dia ); 45 QVBoxLayout lay( &dia );
46 lay.setMargin(7); 46 lay.setMargin(7);
47 lay.setSpacing(7); 47 lay.setSpacing(7);
48 QString file = fn; 48 QString file = fn;
49 if ( file.isEmpty() ) 49 if ( file.isEmpty() )
50 file = QDir::homeDirPath()+"/*";; 50 file = QDir::homeDirPath()+"/*";;
51 QFileInfo fi ( file ); 51 QFileInfo fi ( file );
52 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); 52 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
53 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); 53 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
54 lay.addWidget( &o); 54 lay.addWidget( &o);
55 dia.showMaximized(); 55 dia.showMaximized();
56 dia.setCaption( cap ); 56 dia.setCaption( cap );
57 int res = dia.exec(); 57 int res = dia.exec();
58 if ( res ) 58 if ( res )
59 retfile = o.selectedName(); 59 retfile = o.selectedName();
60 return retfile; 60 return retfile;
61} 61}
62 62QString KFileDialog::getExistingDirectory( const QString & fn,
63 const QString & cap, QWidget * par )
64{
65 return KFileDialog::getSaveFileName( fn, cap, pr );
66}
63#else 67#else
64 68
65#include <qfiledialog.h> 69#include <qfiledialog.h>
66 70
67QString KFileDialog::getSaveFileName( const QString & fn, 71QString KFileDialog::getSaveFileName( const QString & fn,
68 const QString & cap , QWidget * par ) 72 const QString & cap , QWidget * par )
69{ 73{
70 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); 74 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
71} 75}
72QString KFileDialog::getOpenFileName( const QString & fn, 76QString KFileDialog::getOpenFileName( const QString & fn,
73 const QString & cap, QWidget * par ) 77 const QString & cap, QWidget * par )
74{ 78{
75 79
76 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); 80 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
77} 81}
82QString KFileDialog::getExistingDirectory( const QString & fn,
83 const QString & cap, QWidget * par )
84{
85 return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
86}
78#endif 87#endif
79 88
diff --git a/microkde/kfiledialog.h b/microkde/kfiledialog.h
index 0825872..90709cd 100644
--- a/microkde/kfiledialog.h
+++ b/microkde/kfiledialog.h
@@ -1,20 +1,22 @@
1#ifndef MICROKDE_KFILEDIALOG_H 1#ifndef MICROKDE_KFILEDIALOG_H
2#define MICROKDE_KFILEDIALOG_H 2#define MICROKDE_KFILEDIALOG_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qwidget.h> 5#include <qwidget.h>
6 6
7class KFileDialog 7class KFileDialog
8{ 8{
9 public: 9 public:
10 10
11 static QString getSaveFileName( const QString &, 11 static QString getSaveFileName( const QString &,
12 const QString &, QWidget * ); 12 const QString &, QWidget * );
13 13
14 14
15 static QString getOpenFileName( const QString &, 15 static QString getOpenFileName( const QString &,
16 const QString &, QWidget * ); 16 const QString &, QWidget * );
17 17
18 static QString getExistingDirectory( const QString &,
19 const QString &, QWidget * );
18}; 20};
19 21
20#endif 22#endif
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index 991c8be..ca94570 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -166,158 +166,161 @@ public:
166 166
167/*US 167/*US
168KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent, 168KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent,
169 const char *name ) 169 const char *name )
170 : QHBox( parent, name ) 170 : QHBox( parent, name )
171{ 171{
172 d = new KURLRequesterPrivate; 172 d = new KURLRequesterPrivate;
173 173
174 // must have this as parent 174 // must have this as parent
175 editWidget->reparent( this, 0, QPoint(0,0) ); 175 editWidget->reparent( this, 0, QPoint(0,0) );
176//US d->edit = dynamic_cast<KLineEdit*>( editWidget ); 176//US d->edit = dynamic_cast<KLineEdit*>( editWidget );
177 d->edit = (KLineEdit*)( editWidget ); 177 d->edit = (KLineEdit*)( editWidget );
178//US d->combo = dynamic_cast<KComboBox*>( editWidget ); 178//US d->combo = dynamic_cast<KComboBox*>( editWidget );
179 179
180 init(); 180 init();
181} 181}
182*/ 182*/
183 183
184KURLRequester::KURLRequester( QWidget *parent, const char *name ) 184KURLRequester::KURLRequester( QWidget *parent, const char *name )
185 : QHBox( parent, name ) 185 : QHBox( parent, name )
186{ 186{
187 d = new KURLRequesterPrivate; 187 d = new KURLRequesterPrivate;
188 init(); 188 init();
189} 189}
190 190
191 191
192KURLRequester::KURLRequester( const QString& url, QWidget *parent, 192KURLRequester::KURLRequester( const QString& url, QWidget *parent,
193 const char *name ) 193 const char *name )
194 : QHBox( parent, name ) 194 : QHBox( parent, name )
195{ 195{
196 d = new KURLRequesterPrivate; 196 d = new KURLRequesterPrivate;
197 init(); 197 init();
198 setURL( url ); 198 setURL( url );
199} 199}
200 200
201 201
202KURLRequester::~KURLRequester() 202KURLRequester::~KURLRequester()
203{ 203{
204//US delete myCompletion; 204//US delete myCompletion;
205 delete myFileDialog; 205 delete myFileDialog;
206 delete d; 206 delete d;
207} 207}
208 208
209 209
210void KURLRequester::init() 210void KURLRequester::init()
211{ 211{
212 myFileDialog = 0L; 212 myFileDialog = 0L;
213 myShowLocalProt = false; 213 myShowLocalProt = false;
214 214 mPathIsDir = false;
215 if (/*US !d->combo && */ !d->edit ) 215 if (/*US !d->combo && */ !d->edit )
216 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); 216 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
217 217
218 myButton = new KURLDragPushButton( this, "kfile button"); 218 myButton = new KURLDragPushButton( this, "kfile button");
219 QIconSet iconSet = SmallIconSet("fileopen"); 219 QIconSet iconSet = SmallIconSet("fileopen");
220 QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); 220 QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
221 myButton->setIconSet( iconSet ); 221 myButton->setIconSet( iconSet );
222 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); 222 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
223//US QToolTip::add(myButton, i18n("Open file dialog")); 223//US QToolTip::add(myButton, i18n("Open file dialog"));
224 224
225 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); 225 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
226 226
227 setSpacing( KDialog::spacingHint() ); 227 setSpacing( KDialog::spacingHint() );
228 228
229 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; 229 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit;
230 setFocusProxy( widget ); 230 setFocusProxy( widget );
231 231
232 d->connectSignals( this ); 232 d->connectSignals( this );
233 connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() )); 233 connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() ));
234/*US 234/*US
235 myCompletion = new KURLCompletion(); 235 myCompletion = new KURLCompletion();
236 d->setCompletionObject( myCompletion ); 236 d->setCompletionObject( myCompletion );
237 237
238 KAccel *accel = new KAccel( this ); 238 KAccel *accel = new KAccel( this );
239 accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() )); 239 accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() ));
240 accel->readSettings(); 240 accel->readSettings();
241*/ 241*/
242} 242}
243 243
244 244
245void KURLRequester::setURL( const QString& url ) 245void KURLRequester::setURL( const QString& url )
246{ 246{
247 bool hasLocalPrefix = (url.startsWith("file:")); 247 bool hasLocalPrefix = (url.startsWith("file:"));
248 248
249 if ( !myShowLocalProt && hasLocalPrefix ) 249 if ( !myShowLocalProt && hasLocalPrefix )
250 d->setText( url.mid( 5, url.length()-5 )); 250 d->setText( url.mid( 5, url.length()-5 ));
251 else 251 else
252 d->setText( url ); 252 d->setText( url );
253} 253}
254 254
255void KURLRequester::setCaption( const QString& caption ) 255void KURLRequester::setCaption( const QString& caption )
256{ 256{
257 //USfileDialog()->setCaption( caption ); 257 //USfileDialog()->setCaption( caption );
258 //USQWidget::setCaption( caption ); 258 //USQWidget::setCaption( caption );
259} 259}
260 260
261QString KURLRequester::url() const 261QString KURLRequester::url() const
262{ 262{
263 return d->url(); 263 return d->url();
264} 264}
265 265
266 266
267void KURLRequester::slotOpenDialog() 267void KURLRequester::slotOpenDialog()
268{ 268{
269 emit openFileDialog( this ); 269 emit openFileDialog( this );
270 270
271//US use our special KFIleDialog instead 271//US use our special KFIleDialog instead
272 KURL u( url() ); 272 KURL u( url() );
273 //QString fn = u.url(); 273 //QString fn = u.url();
274 QString fn = d->edit->text(); 274 QString fn = d->edit->text();
275 fn = KFileDialog::getSaveFileName( fn, "", this ); 275 if ( mPathIsDir )
276 fn = KFileDialog::getExistingDirectory ( fn, "", this );
277 else
278 fn = KFileDialog::getSaveFileName( fn, "", this );
276 279
277 if ( fn == "" ) 280 if ( fn == "" )
278 return; 281 return;
279 282
280 setURL( fn ); 283 setURL( fn );
281 emit urlSelected( d->url() ); 284 emit urlSelected( d->url() );
282/*US 285/*US
283 KFileDialog *dlg = fileDialog(); 286 KFileDialog *dlg = fileDialog();
284 if ( !d->url().isEmpty() ) { 287 if ( !d->url().isEmpty() ) {
285 KURL u( url() ); 288 KURL u( url() );
286 // If we won't be able to list it (e.g. http), then don't try :) 289 // If we won't be able to list it (e.g. http), then don't try :)
287 if ( KProtocolInfo::supportsListing( u.protocol() ) ) 290 if ( KProtocolInfo::supportsListing( u.protocol() ) )
288 dlg->setSelection( u.url() ); 291 dlg->setSelection( u.url() );
289 } 292 }
290 293
291 if ( dlg->exec() == QDialog::Accepted ) 294 if ( dlg->exec() == QDialog::Accepted )
292 { 295 {
293 setURL( dlg->selectedURL().prettyURL() ); 296 setURL( dlg->selectedURL().prettyURL() );
294 emit urlSelected( d->url() ); 297 emit urlSelected( d->url() );
295 } 298 }
296*/ 299*/
297 300
298} 301}
299 302
300void KURLRequester::setMode(unsigned int mode) 303void KURLRequester::setMode(unsigned int mode)
301{ 304{
302/*US 305/*US
303 Q_ASSERT( (mode & KFile::Files) == 0 ); 306 Q_ASSERT( (mode & KFile::Files) == 0 );
304 d->fileDialogMode = mode; 307 d->fileDialogMode = mode;
305 if ( (mode & KFile::Directory) && !(mode & KFile::File) ) 308 if ( (mode & KFile::Directory) && !(mode & KFile::File) )
306 myCompletion->setMode( KURLCompletion::DirCompletion ); 309 myCompletion->setMode( KURLCompletion::DirCompletion );
307 310
308 if (myFileDialog) 311 if (myFileDialog)
309 myFileDialog->setMode( d->fileDialogMode ); 312 myFileDialog->setMode( d->fileDialogMode );
310*/ 313*/
311} 314}
312 315
313void KURLRequester::setFilter(const QString &filter) 316void KURLRequester::setFilter(const QString &filter)
314{ 317{
315/*US 318/*US
316 d->fileDialogFilter = filter; 319 d->fileDialogFilter = filter;
317 if (myFileDialog) 320 if (myFileDialog)
318 myFileDialog->setFilter( d->fileDialogFilter ); 321 myFileDialog->setFilter( d->fileDialogFilter );
319*/ 322*/
320} 323}
321 324
322KFileDialog * KURLRequester::fileDialog() const 325KFileDialog * KURLRequester::fileDialog() const
323{ 326{
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h
index 3253dd5..faa3326 100644
--- a/microkde/kio/kfile/kurlrequester.h
+++ b/microkde/kio/kfile/kurlrequester.h
@@ -60,96 +60,97 @@ class KURLRequester : public QHBox
60 60
61public: 61public:
62 /** 62 /**
63 * Constructs a KURLRequester widget. 63 * Constructs a KURLRequester widget.
64 */ 64 */
65 KURLRequester( QWidget *parent=0, const char *name=0 ); 65 KURLRequester( QWidget *parent=0, const char *name=0 );
66 66
67 /** 67 /**
68 * Constructs a KURLRequester widget with the initial URL @p url. 68 * Constructs a KURLRequester widget with the initial URL @p url.
69 */ 69 */
70 KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 ); 70 KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 );
71 71
72 /** 72 /**
73 * Special constructor, which creates a KURLRequester widget with a custom 73 * Special constructor, which creates a KURLRequester widget with a custom
74 * edit-widget. The edit-widget can be either a KComboBox or a KLineEdit 74 * edit-widget. The edit-widget can be either a KComboBox or a KLineEdit
75 * (or inherited thereof). Note: for geometry management reasons, the 75 * (or inherited thereof). Note: for geometry management reasons, the
76 * edit-widget is reparented to have the KURLRequester as parent. 76 * edit-widget is reparented to have the KURLRequester as parent.
77 * @param modal specifies whether the filedialog should be opened as modal 77 * @param modal specifies whether the filedialog should be opened as modal
78 * or not. 78 * or not.
79 */ 79 */
80//US KURLRequester( QWidget *editWidget, QWidget *parent, const char *name=0 ); 80//US KURLRequester( QWidget *editWidget, QWidget *parent, const char *name=0 );
81 /** 81 /**
82 * Destructs the KURLRequester. 82 * Destructs the KURLRequester.
83 */ 83 */
84 ~KURLRequester(); 84 ~KURLRequester();
85 85
86 /** 86 /**
87 * @returns the current url in the lineedit. May be malformed, if the user 87 * @returns the current url in the lineedit. May be malformed, if the user
88 * entered something weird. ~user or environment variables are substituted 88 * entered something weird. ~user or environment variables are substituted
89 * for local files. 89 * for local files.
90 */ 90 */
91 QString url() const; 91 QString url() const;
92 92
93 /** 93 /**
94 * Enables/disables showing file:/ in the lineedit, when a local file has 94 * Enables/disables showing file:/ in the lineedit, when a local file has
95 * been selected in the filedialog or was set via @ref setURL(). 95 * been selected in the filedialog or was set via @ref setURL().
96 * Default is false, not showing file:/ 96 * Default is false, not showing file:/
97 * @see #showLocalProtocol 97 * @see #showLocalProtocol
98 */ 98 */
99 void setShowLocalProtocol( bool b ); 99 void setShowLocalProtocol( bool b );
100 100
101 /** 101 /**
102 * Sets the mode of the file dialog. 102 * Sets the mode of the file dialog.
103 * Note: you can only select one file with the filedialog, 103 * Note: you can only select one file with the filedialog,
104 * so KFile::Files doesn't make much sense. 104 * so KFile::Files doesn't make much sense.
105 * @see KFileDialog::setMode() 105 * @see KFileDialog::setMode()
106 */ 106 */
107 void setMode( unsigned int m ); 107 void setMode( unsigned int m );
108 void setPathIsDir( ) {mPathIsDir = true;}
108 109
109 /** 110 /**
110 * Sets the filter for the file dialog. 111 * Sets the filter for the file dialog.
111 * @see KFileDialog::setFilter() 112 * @see KFileDialog::setFilter()
112 */ 113 */
113 void setFilter( const QString& filter ); 114 void setFilter( const QString& filter );
114 115
115 /** 116 /**
116 * @returns whether local files will be prefixed with file:/ in the 117 * @returns whether local files will be prefixed with file:/ in the
117 * lineedit 118 * lineedit
118 * @see #setShowLocalProtocol 119 * @see #setShowLocalProtocol
119 */ 120 */
120 bool showLocalProtocol() const { return myShowLocalProt; } 121 bool showLocalProtocol() const { return myShowLocalProt; }
121 122
122 /** 123 /**
123 * @returns a pointer to the filedialog 124 * @returns a pointer to the filedialog
124 * You can use this to customize the dialog, e.g. to specify a filter. 125 * You can use this to customize the dialog, e.g. to specify a filter.
125 * Never returns 0L. 126 * Never returns 0L.
126 */ 127 */
127 virtual KFileDialog * fileDialog() const; 128 virtual KFileDialog * fileDialog() const;
128 129
129 /** 130 /**
130 * @returns a pointer to the lineedit, either the default one, or the 131 * @returns a pointer to the lineedit, either the default one, or the
131 * special one, if you used the special constructor. 132 * special one, if you used the special constructor.
132 * 133 *
133 * It is provided so that you can e.g. set an own completion object 134 * It is provided so that you can e.g. set an own completion object
134 * (e.g. @ref KShellCompletion) into it. 135 * (e.g. @ref KShellCompletion) into it.
135 */ 136 */
136 KLineEdit * lineEdit() const; 137 KLineEdit * lineEdit() const;
137 138
138 /** 139 /**
139 * @returns a pointer to the combobox, in case you have set one using the 140 * @returns a pointer to the combobox, in case you have set one using the
140 * special constructor. Returns 0L otherwise. 141 * special constructor. Returns 0L otherwise.
141 */ 142 */
142//US KComboBox * comboBox() const; 143//US KComboBox * comboBox() const;
143 144
144 /** 145 /**
145 * @returns a pointer to the pushbutton. It is provided so that you can 146 * @returns a pointer to the pushbutton. It is provided so that you can
146 * specify an own pixmap or a text, if you really need to. 147 * specify an own pixmap or a text, if you really need to.
147 */ 148 */
148 QPushButton * button() const; 149 QPushButton * button() const;
149 150
150 /** 151 /**
151 * @returns the KURLCompletion object used in the lineedit/combobox. 152 * @returns the KURLCompletion object used in the lineedit/combobox.
152 */ 153 */
153//US KURLCompletion *completionObject() const { return myCompletion; } 154//US KURLCompletion *completionObject() const { return myCompletion; }
154 155
155 /** 156 /**
@@ -189,81 +190,82 @@ signals:
189 // forwards from LineEdit 190 // forwards from LineEdit
190 /** 191 /**
191 * Emitted when the text in the lineedit changes. 192 * Emitted when the text in the lineedit changes.
192 * The parameter contains the contents of the lineedit. 193 * The parameter contains the contents of the lineedit.
193 * @since 3.1 194 * @since 3.1
194 */ 195 */
195 void textChanged( const QString& ); 196 void textChanged( const QString& );
196 197
197 /** 198 /**
198 * Emitted when return or enter was pressed in the lineedit. 199 * Emitted when return or enter was pressed in the lineedit.
199 */ 200 */
200 void returnPressed(); 201 void returnPressed();
201 202
202 /** 203 /**
203 * Emitted when return or enter was pressed in the lineedit. 204 * Emitted when return or enter was pressed in the lineedit.
204 * The parameter contains the contents of the lineedit. 205 * The parameter contains the contents of the lineedit.
205 */ 206 */
206 void returnPressed( const QString& ); 207 void returnPressed( const QString& );
207 208
208 /** 209 /**
209 * Emitted before the filedialog is going to open. Connect 210 * Emitted before the filedialog is going to open. Connect
210 * to this signal to "configure" the filedialog, e.g. set the 211 * to this signal to "configure" the filedialog, e.g. set the
211 * filefilter, the mode, a preview-widget, etc. It's usually 212 * filefilter, the mode, a preview-widget, etc. It's usually
212 * not necessary to set a URL for the filedialog, as it will 213 * not necessary to set a URL for the filedialog, as it will
213 * get set properly from the editfield contents. 214 * get set properly from the editfield contents.
214 * 215 *
215 * If you use multiple KURLRequesters, you can connect all of them 216 * If you use multiple KURLRequesters, you can connect all of them
216 * to the same slot and use the given KURLRequester pointer to know 217 * to the same slot and use the given KURLRequester pointer to know
217 * which one is going to open. 218 * which one is going to open.
218 */ 219 */
219 void openFileDialog( KURLRequester * ); 220 void openFileDialog( KURLRequester * );
220 221
221 /** 222 /**
222 * Emitted when the user changed the URL via the file dialog. 223 * Emitted when the user changed the URL via the file dialog.
223 * The parameter contains the contents of the lineedit. 224 * The parameter contains the contents of the lineedit.
224 */ 225 */
225 void urlSelected( const QString& ); 226 void urlSelected( const QString& );
226 227
227protected: 228protected:
228 void init(); 229 void init();
229 230
230//US KURLCompletion * myCompletion; 231//US KURLCompletion * myCompletion;
231 232
232 233
233private: 234private:
234 KURLDragPushButton * myButton; 235 KURLDragPushButton * myButton;
235 bool myShowLocalProt; 236 bool myShowLocalProt;
236 mutable KFileDialog * myFileDialog; 237 mutable KFileDialog * myFileDialog;
238 bool mPathIsDir;
237 239
238 240
239protected slots: 241protected slots:
240 /** 242 /**
241 * Called when the button is pressed to open the filedialog. 243 * Called when the button is pressed to open the filedialog.
242 * Also called when @ref KStdAccel::Open (default is Ctrl-O) is pressed. 244 * Also called when @ref KStdAccel::Open (default is Ctrl-O) is pressed.
243 */ 245 */
244 void slotOpenDialog(); 246 void slotOpenDialog();
245 247
246private slots: 248private slots:
247 void slotUpdateURL(); 249 void slotUpdateURL();
248 250
249protected: 251protected:
250 virtual void virtual_hook( int id, void* data ); 252 virtual void virtual_hook( int id, void* data );
251private: 253private:
252 class KURLRequesterPrivate; 254 class KURLRequesterPrivate;
253 KURLRequesterPrivate *d; 255 KURLRequesterPrivate *d;
254}; 256};
255/*US 257/*US
256class KURLComboRequester : public KURLRequester // For use in Qt Designer 258class KURLComboRequester : public KURLRequester // For use in Qt Designer
257{ 259{
258 Q_OBJECT 260 Q_OBJECT
259public: 261public:
260*/ 262*/
261 /** 263 /**
262 * Constructs a KURLRequester widget with a combobox. 264 * Constructs a KURLRequester widget with a combobox.
263 */ 265 */
264/*US 266/*US
265 KURLComboRequester( QWidget *parent=0, const char *name=0 ); 267 KURLComboRequester( QWidget *parent=0, const char *name=0 );
266}; 268};
267*/ 269*/
268 270
269#endif // KURLREQUESTER_H 271#endif // KURLREQUESTER_H