summaryrefslogtreecommitdiffstats
path: root/libkonq/konqbookmarkmanager.h
blob: 88ff45ced91a28451b28a6643cac1b037f9b3dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef KONQBOOKMARKMANAGER_H
#define KONQBOOKMARKMANAGER_H

#include <kbookmarkmanager.h>
#include <kstandarddirs.h>
#include <kurl.h>
#include <tdeio/job.h>
#include <libkonq_export.h>
#include <tdeapplication.h>

class LIBKONQ_EXPORT KonqBookmarkManager
{
public:
    static KBookmarkManager * self()
    {
        if ( !s_bookmarkManager )
        {
            TQString globalBookmarkFile = locate( "data",  TQString::fromLatin1( "konqueror/bookmarks.xml" ) );
            TQString bookmarksFile = locateLocal( "data", TQString::fromLatin1("konqueror/bookmarks.xml" ), true);
            if (globalBookmarkFile != TQString::null && bookmarksFile != TQString::null &&
                globalBookmarkFile != bookmarksFile)
            {
                TDEIO::file_copy(KURL::fromPathOrURL(globalBookmarkFile),
                                 KURL::fromPathOrURL(bookmarksFile));
                kapp->processEvents(3000);   // Allows up to 3 seconds to copy the file
            }
            s_bookmarkManager = KBookmarkManager::managerForFile( bookmarksFile );
        }
        return s_bookmarkManager;
    }

private:
    static KBookmarkManager *s_bookmarkManager;
};

#endif