summaryrefslogtreecommitdiffabout
path: root/microkde/kio
Unidiff
Diffstat (limited to 'microkde/kio') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp10
-rw-r--r--microkde/kio/kfile/kurlrequester.h4
-rw-r--r--microkde/kio/kio/kdirwatch.cpp12
-rw-r--r--microkde/kio/kio/kdirwatch_p.h10
4 files changed, 20 insertions, 16 deletions
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index ca94570..ce62da7 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -18,24 +18,26 @@
18 18
19 19
20#include <sys/stat.h> 20#include <sys/stat.h>
21#ifdef _WIN32_ 21#ifdef _WIN32_
22 22
23#else 23#else
24#include <unistd.h> 24#include <unistd.h>
25#endif 25#endif
26#include <qstring.h> 26#include <qstring.h>
27//US #include <qtooltip.h> 27//US #include <qtooltip.h>
28 28
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30//Added by qt3to4:
31#include <QPixmap>
30 32
31//US #include <kaccel.h> 33//US #include <kaccel.h>
32//US #include <kcombobox.h> 34//US #include <kcombobox.h>
33#include <kdebug.h> 35#include <kdebug.h>
34#include <kdialog.h> 36#include <kdialog.h>
35#include <kfiledialog.h> 37#include <kfiledialog.h>
36#include <kglobal.h> 38#include <kglobal.h>
37#include <kiconloader.h> 39#include <kiconloader.h>
38#include <klineedit.h> 40#include <klineedit.h>
39#include <klocale.h> 41#include <klocale.h>
40//US #include <kurlcompletion.h> 42//US #include <kurlcompletion.h>
41//US #include <kurldrag.h> 43//US #include <kurldrag.h>
@@ -173,60 +175,60 @@ KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent,
173 175
174 // must have this as parent 176 // must have this as parent
175 editWidget->reparent( this, 0, QPoint(0,0) ); 177 editWidget->reparent( this, 0, QPoint(0,0) );
176//US d->edit = dynamic_cast<KLineEdit*>( editWidget ); 178//US d->edit = dynamic_cast<KLineEdit*>( editWidget );
177 d->edit = (KLineEdit*)( editWidget ); 179 d->edit = (KLineEdit*)( editWidget );
178//US d->combo = dynamic_cast<KComboBox*>( editWidget ); 180//US d->combo = dynamic_cast<KComboBox*>( editWidget );
179 181
180 init(); 182 init();
181} 183}
182*/ 184*/
183 185
184KURLRequester::KURLRequester( QWidget *parent, const char *name ) 186KURLRequester::KURLRequester( QWidget *parent, const char *name )
185 : QHBox( parent, name ) 187 : Q3HBox( parent, name )
186{ 188{
187 d = new KURLRequesterPrivate; 189 d = new KURLRequesterPrivate;
188 init(); 190 init();
189} 191}
190 192
191 193
192KURLRequester::KURLRequester( const QString& url, QWidget *parent, 194KURLRequester::KURLRequester( const QString& url, QWidget *parent,
193 const char *name ) 195 const char *name )
194 : QHBox( parent, name ) 196 : Q3HBox( parent, name )
195{ 197{
196 d = new KURLRequesterPrivate; 198 d = new KURLRequesterPrivate;
197 init(); 199 init();
198 setURL( url ); 200 setURL( url );
199} 201}
200 202
201 203
202KURLRequester::~KURLRequester() 204KURLRequester::~KURLRequester()
203{ 205{
204//US delete myCompletion; 206//US delete myCompletion;
205 delete myFileDialog; 207 delete myFileDialog;
206 delete d; 208 delete d;
207} 209}
208 210
209 211
210void KURLRequester::init() 212void KURLRequester::init()
211{ 213{
212 myFileDialog = 0L; 214 myFileDialog = 0L;
213 myShowLocalProt = false; 215 myShowLocalProt = false;
214 mPathIsDir = false; 216 mPathIsDir = false;
215 if (/*US !d->combo && */ !d->edit ) 217 if (/*US !d->combo && */ !d->edit )
216 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" ); 218 d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
217 219
218 myButton = new KURLDragPushButton( this, "kfile button"); 220 myButton = new KURLDragPushButton( this, "kfile button");
219 QIconSet iconSet = SmallIconSet("fileopen"); 221 QIcon iconSet = SmallIconSet("fileopen");
220 QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); 222 QPixmap pixMap = iconSet.pixmap( QIcon::Small, QIcon::Normal );
221 myButton->setIconSet( iconSet ); 223 myButton->setIconSet( iconSet );
222 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); 224 myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
223//US QToolTip::add(myButton, i18n("Open file dialog")); 225//US QToolTip::add(myButton, i18n("Open file dialog"));
224 226
225 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() )); 227 connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
226 228
227 setSpacing( KDialog::spacingHint() ); 229 setSpacing( KDialog::spacingHint() );
228 230
229 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit; 231 QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit;
230 setFocusProxy( widget ); 232 setFocusProxy( widget );
231 233
232 d->connectSignals( this ); 234 d->connectSignals( this );
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h
index faa3326..5d4fa11 100644
--- a/microkde/kio/kfile/kurlrequester.h
+++ b/microkde/kio/kfile/kurlrequester.h
@@ -11,25 +11,25 @@
11 Library General Public License for more details. 11 Library General Public License for more details.
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18 18
19 19
20#ifndef KURLREQUESTER_H 20#ifndef KURLREQUESTER_H
21#define KURLREQUESTER_H 21#define KURLREQUESTER_H
22 22
23#include <qhbox.h> 23#include <q3hbox.h>
24 24
25#include <keditlistbox.h> 25#include <keditlistbox.h>
26//US #include <kfile.h> 26//US #include <kfile.h>
27//US #include <kpushbutton.h> 27//US #include <kpushbutton.h>
28#include <kurl.h> 28#include <kurl.h>
29 29
30//US class KComboBox; 30//US class KComboBox;
31 31
32class KFileDialog; 32class KFileDialog;
33class KLineEdit; 33class KLineEdit;
34//US class KURLCompletion; 34//US class KURLCompletion;
35class KURLDragPushButton; 35class KURLDragPushButton;
@@ -44,25 +44,25 @@ class QTimer;
44 * 44 *
45 * The defaults for the filedialog are to ask for one existing local file, i.e. 45 * The defaults for the filedialog are to ask for one existing local file, i.e.
46 * KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ) 46 * KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly )
47 * The default filter is "*", i.e. show all files, and the start directory is 47 * The default filter is "*", i.e. show all files, and the start directory is
48 * the current working directory, or the last directory where a file has been 48 * the current working directory, or the last directory where a file has been
49 * selected. 49 * selected.
50 * 50 *
51 * You can change this behavior by using @ref setMode() or @ref setFilter(). 51 * You can change this behavior by using @ref setMode() or @ref setFilter().
52 * 52 *
53 * @short A widget to request a filename/url from the user 53 * @short A widget to request a filename/url from the user
54 * @author Carsten Pfeiffer <pfeiffer@kde.org> 54 * @author Carsten Pfeiffer <pfeiffer@kde.org>
55 */ 55 */
56class KURLRequester : public QHBox 56class KURLRequester : public Q3HBox
57{ 57{
58 Q_OBJECT 58 Q_OBJECT
59 Q_PROPERTY( QString url READ url WRITE setURL ) 59 Q_PROPERTY( QString url READ url WRITE setURL )
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.
diff --git a/microkde/kio/kio/kdirwatch.cpp b/microkde/kio/kio/kdirwatch.cpp
index 1596d1f..5f07c54 100644
--- a/microkde/kio/kio/kdirwatch.cpp
+++ b/microkde/kio/kio/kdirwatch.cpp
@@ -43,29 +43,31 @@ $Id$
43#ifdef HAVE_DNOTIFY 43#ifdef HAVE_DNOTIFY
44#include <unistd.h> 44#include <unistd.h>
45#include <time.h> 45#include <time.h>
46#include <fcntl.h> 46#include <fcntl.h>
47#include <signal.h> 47#include <signal.h>
48#include <errno.h> 48#include <errno.h>
49#endif 49#endif
50 50
51#include <sys/stat.h> 51#include <sys/stat.h>
52#include <assert.h> 52#include <assert.h>
53#include <qdir.h> 53#include <qdir.h>
54#include <qfile.h> 54#include <qfile.h>
55#include <qintdict.h> 55#include <q3intdict.h>
56#include <qptrlist.h> 56#include <q3ptrlist.h>
57#include <qsocketnotifier.h> 57#include <qsocketnotifier.h>
58#include <qstringlist.h> 58#include <qstringlist.h>
59#include <qtimer.h> 59#include <qtimer.h>
60//Added by qt3to4:
61#include <Q3CString>
60 62
61#include <kapplication.h> 63#include <kapplication.h>
62#include <kdebug.h> 64#include <kdebug.h>
63#include <kconfig.h> 65#include <kconfig.h>
64#include <kconfigbase.h> 66#include <kconfigbase.h>
65#include <kglobal.h> 67#include <kglobal.h>
66#include <kstaticdeleter.h> 68#include <kstaticdeleter.h>
67 69
68#include "kdirwatch.h" 70#include "kdirwatch.h"
69#include "kdirwatch_p.h" 71#include "kdirwatch_p.h"
70//US #include "global.h" // KIO::probably_slow_mounted 72//US #include "global.h" // KIO::probably_slow_mounted
71 73
@@ -175,25 +177,25 @@ KDirWatchPrivate::KDirWatchPrivate()
175{ 177{
176 timer = new QTimer(this); 178 timer = new QTimer(this);
177 connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan())); 179 connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan()));
178 freq = 3600000; // 1 hour as upper bound 180 freq = 3600000; // 1 hour as upper bound
179 statEntries = 0; 181 statEntries = 0;
180 delayRemove = false; 182 delayRemove = false;
181 m_ref = 0; 183 m_ref = 0;
182 184
183//US KConfigGroup config(KGlobal::config(), QCString("DirWatch")); 185//US KConfigGroup config(KGlobal::config(), QCString("DirWatch"));
184//US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000); 186//US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000);
185//US m_PollInterval = config.readNumEntry("PollInterval", 500); 187//US m_PollInterval = config.readNumEntry("PollInterval", 500);
186 KConfig *config = KGlobal::config(); 188 KConfig *config = KGlobal::config();
187 KConfigGroupSaver saver( config, QCString("DirWatch") ); 189 KConfigGroupSaver saver( config, Q3CString("DirWatch") );
188 190
189 m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000); 191 m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000);
190 m_PollInterval = config->readNumEntry("PollInterval", 500); 192 m_PollInterval = config->readNumEntry("PollInterval", 500);
191 193
192 194
193 QString available("Stat"); 195 QString available("Stat");
194 196
195#ifdef HAVE_FAM 197#ifdef HAVE_FAM
196 // It's possible that FAM server can't be started 198 // It's possible that FAM server can't be started
197 if (FAMOpen(&fc) ==0) { 199 if (FAMOpen(&fc) ==0) {
198 available += ", FAM"; 200 available += ", FAM";
199 use_fam=true; 201 use_fam=true;
@@ -722,25 +724,25 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
722 << (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString("")) 724 << (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString(""))
723 << (instance ? QString(" [%1]").arg(instance->name()) : QString("")) 725 << (instance ? QString(" [%1]").arg(instance->name()) : QString(""))
724 << endl; 726 << endl;
725 m_mapEntries.remove( e->path ); // <e> not valid any more 727 m_mapEntries.remove( e->path ); // <e> not valid any more
726} 728}
727 729
728 730
729/* Called from KDirWatch destructor: 731/* Called from KDirWatch destructor:
730 * remove <instance> as client from all entries 732 * remove <instance> as client from all entries
731 */ 733 */
732void KDirWatchPrivate::removeEntries( KDirWatch* instance ) 734void KDirWatchPrivate::removeEntries( KDirWatch* instance )
733{ 735{
734 QPtrList<Entry> list; 736 Q3PtrList<Entry> list;
735 int minfreq = 3600000; 737 int minfreq = 3600000;
736 738
737 // put all entries where instance is a client in list 739 // put all entries where instance is a client in list
738 EntryMap::Iterator it = m_mapEntries.begin(); 740 EntryMap::Iterator it = m_mapEntries.begin();
739 for( ; it != m_mapEntries.end(); ++it ) { 741 for( ; it != m_mapEntries.end(); ++it ) {
740 Client* c = (*it).m_clients.first(); 742 Client* c = (*it).m_clients.first();
741 for(;c;c=(*it).m_clients.next()) 743 for(;c;c=(*it).m_clients.next())
742 if (c->instance == instance) break; 744 if (c->instance == instance) break;
743 if (c) { 745 if (c) {
744 c->count = 1; // forces deletion of instance as client 746 c->count = 1; // forces deletion of instance as client
745 list.append(&(*it)); 747 list.append(&(*it));
746 } 748 }
@@ -998,25 +1000,25 @@ void KDirWatchPrivate::slotRescan()
998 // People can do very long things in the slot connected to dirty(), 1000 // People can do very long things in the slot connected to dirty(),
999 // like showing a message box. We don't want to keep polling during 1001 // like showing a message box. We don't want to keep polling during
1000 // that time, otherwise the value of 'delayRemove' will be reset. 1002 // that time, otherwise the value of 'delayRemove' will be reset.
1001 bool timerRunning = timer->isActive(); 1003 bool timerRunning = timer->isActive();
1002 if ( timerRunning ) 1004 if ( timerRunning )
1003 timer->stop(); 1005 timer->stop();
1004 1006
1005 // We delay deletions of entries this way. 1007 // We delay deletions of entries this way.
1006 // removeDir(), when called in slotDirty(), can cause a crash otherwise 1008 // removeDir(), when called in slotDirty(), can cause a crash otherwise
1007 delayRemove = true; 1009 delayRemove = true;
1008 1010
1009#ifdef HAVE_DNOTIFY 1011#ifdef HAVE_DNOTIFY
1010 QPtrList<Entry> dList, cList; 1012 Q3PtrList<Entry> dList, cList;
1011 1013
1012 // for DNotify method, 1014 // for DNotify method,
1013 if (rescan_all) 1015 if (rescan_all)
1014 { 1016 {
1015 // mark all as dirty 1017 // mark all as dirty
1016 it = m_mapEntries.begin(); 1018 it = m_mapEntries.begin();
1017 for( ; it != m_mapEntries.end(); ++it ) 1019 for( ; it != m_mapEntries.end(); ++it )
1018 (*it).dn_dirty = true; 1020 (*it).dn_dirty = true;
1019 rescan_all = false; 1021 rescan_all = false;
1020 } 1022 }
1021 else 1023 else
1022 { 1024 {
diff --git a/microkde/kio/kio/kdirwatch_p.h b/microkde/kio/kio/kdirwatch_p.h
index 0ab482f..be74f2a 100644
--- a/microkde/kio/kio/kdirwatch_p.h
+++ b/microkde/kio/kio/kdirwatch_p.h
@@ -9,25 +9,25 @@ Enhanced Version of the file for platform independent KDE tools.
9Copyright (c) 2004 Ulf Schenk 9Copyright (c) 2004 Ulf Schenk
10 10
11$Id$ 11$Id$
12*/ 12*/
13 13
14#ifndef _KDIRWATCH_P_H 14#ifndef _KDIRWATCH_P_H
15#define _KDIRWATCH_P_H 15#define _KDIRWATCH_P_H
16 16
17#ifdef HAVE_FAM 17#ifdef HAVE_FAM
18#include <fam.h> 18#include <fam.h>
19#endif 19#endif
20 20
21#include <qptrlist.h> 21#include <q3ptrlist.h>
22 22
23#include <kdirwatch.h> 23#include <kdirwatch.h>
24 24
25#include <ctime> 25#include <ctime>
26 26
27#define invalid_ctime ((time_t)-1) 27#define invalid_ctime ((time_t)-1)
28 28
29/* KDirWatchPrivate is a singleton and does the watching 29/* KDirWatchPrivate is a singleton and does the watching
30 * for every KDirWatch instance in the application. 30 * for every KDirWatch instance in the application.
31 */ 31 */
32class KDirWatchPrivate : public QObject 32class KDirWatchPrivate : public QObject
33{ 33{
@@ -49,27 +49,27 @@ public:
49 49
50 class Entry 50 class Entry
51 { 51 {
52 public: 52 public:
53 // the last observed modification time 53 // the last observed modification time
54 time_t m_ctime; 54 time_t m_ctime;
55 // the last observed link count 55 // the last observed link count
56 int m_nlink; 56 int m_nlink;
57 entryStatus m_status; 57 entryStatus m_status;
58 entryMode m_mode; 58 entryMode m_mode;
59 bool isDir; 59 bool isDir;
60 // instances interested in events 60 // instances interested in events
61 QPtrList<Client> m_clients; 61 Q3PtrList<Client> m_clients;
62 // nonexistent entries of this directory 62 // nonexistent entries of this directory
63 QPtrList<Entry> m_entries; 63 Q3PtrList<Entry> m_entries;
64 QString path; 64 QString path;
65 65
66 int msecLeft, freq; 66 int msecLeft, freq;
67 67
68 void addClient(KDirWatch*); 68 void addClient(KDirWatch*);
69 void removeClient(KDirWatch*); 69 void removeClient(KDirWatch*);
70 int clients(); 70 int clients();
71 bool isValid() { return m_clients.count() || m_entries.count(); } 71 bool isValid() { return m_clients.count() || m_entries.count(); }
72 72
73#ifdef HAVE_FAM 73#ifdef HAVE_FAM
74 FAMRequest fr; 74 FAMRequest fr;
75#endif 75#endif
@@ -115,39 +115,39 @@ public slots:
115public: 115public:
116 QTimer *timer; 116 QTimer *timer;
117 EntryMap m_mapEntries; 117 EntryMap m_mapEntries;
118 118
119private: 119private:
120 int freq; 120 int freq;
121 int statEntries; 121 int statEntries;
122 int m_nfsPollInterval, m_PollInterval; 122 int m_nfsPollInterval, m_PollInterval;
123 int m_ref; 123 int m_ref;
124 bool useStat(Entry*); 124 bool useStat(Entry*);
125 125
126 bool delayRemove; 126 bool delayRemove;
127 QPtrList<Entry> removeList; 127 Q3PtrList<Entry> removeList;
128 128
129#ifdef HAVE_FAM 129#ifdef HAVE_FAM
130 QSocketNotifier *sn; 130 QSocketNotifier *sn;
131 FAMConnection fc; 131 FAMConnection fc;
132 bool use_fam; 132 bool use_fam;
133 133
134 void checkFAMEvent(FAMEvent*); 134 void checkFAMEvent(FAMEvent*);
135 bool useFAM(Entry*); 135 bool useFAM(Entry*);
136#endif 136#endif
137 137
138#ifdef HAVE_DNOTIFY 138#ifdef HAVE_DNOTIFY
139 bool supports_dnotify; 139 bool supports_dnotify;
140 bool rescan_all; 140 bool rescan_all;
141 int mPipe[2]; 141 int mPipe[2];
142 QTimer mTimer; 142 QTimer mTimer;
143 QSocketNotifier *mSn; 143 QSocketNotifier *mSn;
144 QIntDict<Entry> fd_Entry; 144 Q3IntDict<Entry> fd_Entry;
145 145
146 static void dnotify_handler(int, siginfo_t *si, void *); 146 static void dnotify_handler(int, siginfo_t *si, void *);
147 static void dnotify_sigio_handler(int, siginfo_t *si, void *); 147 static void dnotify_sigio_handler(int, siginfo_t *si, void *);
148 bool useDNotify(Entry*); 148 bool useDNotify(Entry*);
149#endif 149#endif
150}; 150};
151 151
152#endif // KDIRWATCH_P_H 152#endif // KDIRWATCH_P_H
153 153