1
/* ============================================================
2
* File : digikamcameraprocess.cpp
3
* Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
7
* Copyright 2003 by Renchi Raju
9
* This program is free software; you can redistribute it
10
* and/or modify it under the terms of the GNU General
11
* Public License as published bythe Free Software Foundation;
12
* either version 2, or (at your option)
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* ============================================================ */
25
#include <kapplication.h>
26
#include <kmessagebox.h>
27
#include <dcopclient.h>
30
#include "digikamcameraprocess.h"
33
DigikamCameraProcess::DigikamCameraProcess(QObject *parent)
36
process_ = new KProcess;
37
*process_ << "digikamcameraclient";
39
connect(process_, SIGNAL(processExited(KProcess*)),
40
this, SLOT(slotProcessEnded()));
43
DigikamCameraProcess::~DigikamCameraProcess()
45
disconnect(process_, SIGNAL(processExited(KProcess*)),
46
this, SLOT(slotProcessEnded()));
51
void DigikamCameraProcess::start()
53
if (!process_->start()) {
54
kdError() << "DigikamCameraProcess: "
55
<< "Failed to launch Camera Process" << endl;
56
KMessageBox::error(0, i18n("Failed to launch Camera Client. "
57
"You would not be able to access the camera(s) "
58
"(Make sure that `digikamcameraclient' is"
59
" installed correctly)"));
62
kdDebug() << "DigikamCameraProcess: "
63
<< "Launched Camera Process" << endl;
66
void DigikamCameraProcess::kill()
71
void DigikamCameraProcess::stop()
73
QByteArray data, replyData;
76
DCOPClient *client = kapp->dcopClient();
77
if (!client->call("digikamcameraclient", "DigikamCameraClient",
78
"close()", data, replyType, replyData))
79
kdError() << "DigikamCameraProcess: DCOP communication error" << endl;
81
kdDebug() << "DigikamCameraProcess: Stopped client" << endl;
84
void DigikamCameraProcess::slotProcessEnded()
86
if (KMessageBox::questionYesNo(0, i18n("Camera Client Died Unexpectedly. "
87
"Shall I restart the process? "
88
"(Note: Otherwise you would not be able to "
89
"access the camera(s))")) ==