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

17
src/ipc.cpp

@ -1,3 +1,20 @@ @@ -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 <QDebug>
#include <QCoreApplication>

17
src/ipc.h

@ -1,3 +1,20 @@ @@ -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
#define IPC_H

17
src/main.cpp

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
#include "misc/settings.h"
#include "src/ipc.h"
#include "src/widget/toxuri.h"
#include "src/widget/toxsave.h"
#include <QApplication>
#include <QFontDatabase>
#include <QDebug>
@ -85,6 +86,7 @@ int main(int argc, char *argv[]) @@ -85,6 +86,7 @@ int main(int argc, char *argv[])
// Inter-process communication
IPC ipc;
ipc.registerEventHandler(&toxURIEventHandler);
ipc.registerEventHandler(&toxSaveEventHandler);
// Process arguments
if (argc >= 2)
@ -107,6 +109,21 @@ int main(int argc, char *argv[]) @@ -107,6 +109,21 @@ int main(int argc, char *argv[])
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

17
src/toxdns.cpp

@ -1,3 +1,20 @@ @@ -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/misc/cdata.h"
#include <QMessageBox>

17
src/toxdns.h

@ -1,3 +1,20 @@ @@ -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
#define QTOXDNS_H

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

@ -201,11 +201,12 @@ void IdentityForm::onImportClicked() @@ -201,11 +201,12 @@ void IdentityForm::onImportClicked()
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)))
return;
QString profilePath = QDir(Settings::getSettingsDirPath()).filePath(profile + Core::TOX_EXT);
QFile::copy(path, profilePath);
bodyUI->profiles->addItem(profile);
}

17
src/widget/toxuri.cpp

@ -1,3 +1,20 @@ @@ -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/toxdns.h"
#include "src/widget/tool/friendrequestdialog.h"

17
src/widget/toxuri.h

@ -1,3 +1,20 @@ @@ -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
#define TOXURI_H

Loading…
Cancel
Save