summaryrefslogtreecommitdiff
path: root/library/global.cpp
authorllornkcor <llornkcor>2006-07-09 18:56:40 (UTC)
committer llornkcor <llornkcor>2006-07-09 18:56:40 (UTC)
commit36dece4760b1ac1799929221b49eb3bee98c2367 (patch) (unidiff)
treea45f66d2d90bd9fbbff8e8903cd1cb9323c39f6e /library/global.cpp
parent604065c6e662cb3894acf03abadafacc3ab52913 (diff)
downloadopie-36dece4760b1ac1799929221b49eb3bee98c2367.zip
opie-36dece4760b1ac1799929221b49eb3bee98c2367.tar.gz
opie-36dece4760b1ac1799929221b49eb3bee98c2367.tar.bz2
initial commit to add video4linux camera app from qtopia 2, needs more work
Diffstat (limited to 'library/global.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/library/global.cpp b/library/global.cpp
index ec87555..f7a0767 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -808,5 +808,54 @@ QStringList Global::helpPath()
808 return path; 808 return path;
809} 809}
810 810
811/*!
812 \internal
813 Truncate file to size specified
814 \a f must be an open file
815 \a size must be a positive value
816 */
817bool Global::truncateFile(QFile &f, int size){
818 if (!f.isOpen())
819 return FALSE;
820
821 return ::ftruncate(f.handle(), size) != -1;
822}
823
824
825
826
827// #if defined(Q_OS_UNIX) && defined(Q_WS_QWS)
828// extern int qws_display_id;
829// #endif
830
831/*!
832 /internal
833 Returns the default system path for storing temporary files.
834 Note: This does not it ensure that the provided directory exists
835*/
836QString Global::tempDir()
837{
838 QString result;
839#ifdef Q_OS_UNIX
840#ifdef Q_WS_QWS
841 result = QString("/tmp/qtopia-%1/").arg(QString::number(qws_display_id));
842#else
843 result="/tmp/";
844#endif
845#else
846 if (getenv("TEMP"))
847 result = getenv("TEMP");
848 else
849 result = getenv("TMP");
850
851 if (result[(int)result.length() - 1] != QDir::separator())
852 result.append(QDir::separator());
853#endif
854
855 return result;
856}
857
858//#endif
859
811 860
812#include "global.moc" 861#include "global.moc"