Browse Source

handle tox save files, also fix IdentForm bug

pull/664/head
dubslow 11 years ago
parent
commit
7a20254dd1
  1. 6
      qtox.pro
  2. 17
      src/ipc.cpp
  3. 17
      src/ipc.h
  4. 17
      src/main.cpp
  5. 17
      src/toxdns.cpp
  6. 17
      src/toxdns.h
  7. 5
      src/widget/form/settings/identityform.cpp
  8. 17
      src/widget/toxuri.cpp
  9. 17
      src/widget/toxuri.h

6
qtox.pro

@ -152,7 +152,8 @@ HEADERS += src/widget/form/addfriendform.h \
src/misc/flowlayout.h \ src/misc/flowlayout.h \
src/ipc.h \ src/ipc.h \
src/widget/toxuri.h \ src/widget/toxuri.h \
src/toxdns.h src/toxdns.h \
src/widget/toxsave.h
SOURCES += \ SOURCES += \
src/widget/form/addfriendform.cpp \ src/widget/form/addfriendform.cpp \
@ -214,4 +215,5 @@ SOURCES += \
src/misc/flowlayout.cpp \ src/misc/flowlayout.cpp \
src/widget/toxuri.cpp \ src/widget/toxuri.cpp \
src/toxdns.cpp \ src/toxdns.cpp \
src/ipc.cpp src/ipc.cpp \
src/widget/toxsave.cpp

17
src/ipc.cpp

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#include "src/ipc.h" #include "src/ipc.h"
#include <QDebug> #include <QDebug>
#include <QCoreApplication> #include <QCoreApplication>

17
src/ipc.h

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#ifndef IPC_H #ifndef IPC_H
#define IPC_H #define IPC_H

17
src/main.cpp

@ -18,6 +18,7 @@
#include "misc/settings.h" #include "misc/settings.h"
#include "src/ipc.h" #include "src/ipc.h"
#include "src/widget/toxuri.h" #include "src/widget/toxuri.h"
#include "src/widget/toxsave.h"
#include <QApplication> #include <QApplication>
#include <QFontDatabase> #include <QFontDatabase>
#include <QDebug> #include <QDebug>
@ -85,6 +86,7 @@ int main(int argc, char *argv[])
// Inter-process communication // Inter-process communication
IPC ipc; IPC ipc;
ipc.registerEventHandler(&toxURIEventHandler); ipc.registerEventHandler(&toxURIEventHandler);
ipc.registerEventHandler(&toxSaveEventHandler);
// Process arguments // Process arguments
if (argc >= 2) if (argc >= 2)
@ -107,6 +109,21 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
} }
else if (firstParam.endsWith(".tox"))
{
if (ipc.isCurrentOwner()) // Don't bother sending an event if we're going to process it ourselves
{
handleToxSave(firstParam.toUtf8());
}
else
{
time_t event = ipc.postEvent(firstParam.toUtf8());
ipc.waitUntilProcessed(event);
// If someone else processed it, we're done here, no need to actually start qTox
if (!ipc.isCurrentOwner())
return EXIT_SUCCESS;
}
}
} }
// Run // Run

17
src/toxdns.cpp

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#include "src/toxdns.h" #include "src/toxdns.h"
#include "src/misc/cdata.h" #include "src/misc/cdata.h"
#include <QMessageBox> #include <QMessageBox>

17
src/toxdns.h

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#ifndef QTOXDNS_H #ifndef QTOXDNS_H
#define QTOXDNS_H #define QTOXDNS_H

5
src/widget/form/settings/identityform.cpp

@ -201,11 +201,12 @@ void IdentityForm::onImportClicked()
return; return;
} }
if (info.exists() && !checkContinue(tr("Profile already exists", "import confirm title"), QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
if (QFileInfo(profilePath).exists() && !checkContinue(tr("Profile already exists", "import confirm title"),
tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile))) tr("A profile named \"%1\" already exists. Do you want to erase it?", "import confirm text").arg(profile)))
return; return;
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
QFile::copy(path, profilePath); QFile::copy(path, profilePath);
bodyUI->profiles->addItem(profile); bodyUI->profiles->addItem(profile);
} }

17
src/widget/toxuri.cpp

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#include "src/widget/toxuri.h" #include "src/widget/toxuri.h"
#include "src/toxdns.h" #include "src/toxdns.h"
#include "src/widget/tool/friendrequestdialog.h" #include "src/widget/tool/friendrequestdialog.h"

17
src/widget/toxuri.h

@ -1,3 +1,20 @@
/*
Copyright (C) 2014 by Project Tox <https://tox.im>
This file is part of qTox, a Qt-based graphical interface for Tox.
This program is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the COPYING file for more details.
*/
#ifndef TOXURI_H #ifndef TOXURI_H
#define TOXURI_H #define TOXURI_H

Loading…
Cancel
Save