Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/kmymoneyutils.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
43 | // KDE Headers | 43 | // KDE Headers | ||
44 | 44 | | |||
45 | #include <KColorScheme> | 45 | #include <KColorScheme> | ||
46 | #include <KLocalizedString> | 46 | #include <KLocalizedString> | ||
47 | #include <KGuiItem> | 47 | #include <KGuiItem> | ||
48 | #include <KXmlGuiWindow> | 48 | #include <KXmlGuiWindow> | ||
49 | #include <KMessageBox> | 49 | #include <KMessageBox> | ||
50 | #include <KStandardGuiItem> | 50 | #include <KStandardGuiItem> | ||
51 | #include <KIO/StatJob> | ||||
51 | 52 | | |||
52 | // ---------------------------------------------------------------------------- | 53 | // ---------------------------------------------------------------------------- | ||
53 | // Project Includes | 54 | // Project Includes | ||
54 | 55 | | |||
55 | #include "mymoneymoney.h" | 56 | #include "mymoneymoney.h" | ||
56 | #include "mymoneyexception.h" | 57 | #include "mymoneyexception.h" | ||
57 | #include "mymoneyfile.h" | 58 | #include "mymoneyfile.h" | ||
58 | #include "mymoneyaccount.h" | 59 | #include "mymoneyaccount.h" | ||
▲ Show 20 Lines • Show All 583 Lines • ▼ Show 20 Line(s) | 642 | if (security.isCurrency()) | |||
642 | file->removeCurrency(security); | 643 | file->removeCurrency(security); | ||
643 | else | 644 | else | ||
644 | file->removeSecurity(security); | 645 | file->removeSecurity(security); | ||
645 | ft.commit(); | 646 | ft.commit(); | ||
646 | } catch (const MyMoneyException &) { | 647 | } catch (const MyMoneyException &) { | ||
647 | } | 648 | } | ||
648 | } | 649 | } | ||
649 | } | 650 | } | ||
651 | | ||||
652 | bool KMyMoneyUtils::fileExists(const QUrl &url) | ||||
653 | { | ||||
654 | bool fileExists = false; | ||||
655 | if (url.isValid()) { | ||||
656 | short int detailLevel = 0; // Lowest level: file/dir/symlink/none | ||||
657 | KIO::StatJob* statjob = KIO::stat(url, KIO::StatJob::SourceSide, detailLevel); | ||||
658 | bool noerror = statjob->exec(); | ||||
659 | if (noerror) { | ||||
660 | // We want a file | ||||
661 | fileExists = !statjob->statResult().isDir(); | ||||
662 | } | ||||
663 | } | ||||
664 | return fileExists; | ||||
665 | } |