OsIndependentString* TextSecurePreferences::GetGcmRegistrationId(OsIndependentContext* context)
{
  int storedRegistrationIdVersion = GetIntegerPreference(context, (OsIndependentString*)GCM_REGISTRATION_ID_VERSION_PREF, 0);
  if (storedRegistrationIdVersion != Util::GetCurrentApkReleaseVersion(context))
  {
    return nullptr;
  }
  else {
    return GetStringPreference(context, (OsIndependentString*)GCM_REGISTRATION_ID_PREF, nullptr);
  }
}
int TextSecurePreferences::GetPassphraseTimeoutInterval(OsIndependentContext* context)
{
  return GetIntegerPreference(context, (OsIndependentString*)PASSPHRASE_TIMEOUT_INTERVAL_PREF, 5 * 60);
}
int TextSecurePreferences::GetLastVersionCode(OsIndependentContext* context)
{
  return GetIntegerPreference(context, (OsIndependentString*)LAST_VERSION_CODE_PREF, 0);
}
int TextSecurePreferences::GetLocalRegistrationId(OsIndependentContext* context)
{
  return GetIntegerPreference(context, (OsIndependentString*)LOCAL_REGISTRATION_ID_PREF, 0);
}
Ejemplo n.º 5
0
#include <fstream>
#include <stdlib.h>
#include <string>
#include <time.h>
#include "CvsIgnore.h"
#include <Utils/PathUtils.h>
#include <Utils/TortoiseRegistry.h>
#include <Utils/TortoiseUtils.h>
#include <Utils/TortoiseDebug.h>
#include <Utils/SyncUtils.h>
#include <Utils/Preference.h>


static DWORD defIgnoreListTimeStamp = 0;
static std::vector<std::string> defIgnoredList;
static DWORD dwUpdateIgnoredListInterval = GetIntegerPreference("IgnoredList update interval");
static CriticalSection myCriticalSection;
static FileChangeParams fcpCvsignore;


// 8-bit safe isspace()
bool myisspace(char c)
{
    return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r');
}


/* Parse a line of space-separated wildcards and add them to the list. */
/* mostly duplicated from cvs/src/ignore.c */
static void ign_add(const char* ign, std::vector<std::string>& ignlist)
{
Ejemplo n.º 6
0
EditorListDialog::EditorListDialog(wxWindow* parent, 
                                   EditorListDialog::EditedFileList& editors)
   : ExtDialog(parent, -1, _("TortoiseCVS - List Editors"),
               wxDefaultPosition, wxDefaultSize,
               wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | 
               wxDEFAULT_DIALOG_STYLE | wxCLIP_CHILDREN),
     mySortCol(SORT_FILE),
     mySortAscending(true)   
{
   TDEBUG_ENTER("EditorListDialog::EditorListDialog");
   SetIcon(wxIcon(wxT("A_TORTOISE"), wxBITMAP_TYPE_ICO_RESOURCE));

   myEditedFiles = &editors;
   
   std::vector<std::string> tmp;
   EditedFileList::iterator it;

   // Add editors
   it = editors.begin();
   while (it != editors.end())
   {
      std::string s(it->myFilename);
      FindAndReplace<std::string>(s, "/", "\\");
      it->myFilename = s;
      tmp.push_back(s);
      it++;
   }

   // Trim paths to sensible length
   ShortenPaths(tmp, myStub);

   // Maybe use dedicated colour later
   myEditColour = ColorRefToWxColour(GetIntegerPreference("Colour Updated Files"));

   FilenameText* label1 = new FilenameText(this, -1, _("Folder: %s"), wxText(RemoveTrailingDelimiter(myStub)));
   label1->SetWindowStyle(label1->GetWindowStyle() | wxST_NO_AUTORESIZE);
   myEditors = new EditorListListCtrl(this, this, EDITORLISTDLG_ID_EDITORS, myEditColour);
   myEditors->SetSortIndicator(mySortCol, mySortAscending);
   AddEditors(tmp, editors);
   myEditors->SetBestColumnWidth(0);
   myEditors->SetBestColumnWidth(1);
   myEditors->SetBestSize(wxDLG_UNIT(this, wxSize(150, 150)), wxDefaultSize);

   // OK button
   wxBoxSizer* sizerConfirm = new wxBoxSizer(wxHORIZONTAL);
   myOK = new wxButton(this, wxID_OK, _("Close"));
   myOK->SetDefault();
   sizerConfirm->Add(myOK, 0, wxGROW | wxALL, 5);

   // Status bar
   myStatusBar = new wxStatusBar(this, -1);
   myStatusBar->SetStatusText(Printf(_("%d edited file(s)"), editors.size()).c_str());

   // Main box with everything in it
   wxBoxSizer* sizerTop = new wxBoxSizer(wxVERTICAL);
   sizerTop->Add(label1, 0, wxGROW | wxALL, 3);
   sizerTop->Add(myEditors, 2, wxGROW | wxALL, 3);
   sizerTop->Add(sizerConfirm, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 10);
   sizerTop->Add(myStatusBar, 0, wxGROW | wxALL, 0);

   // Overall dialog layout settings
   SetAutoLayout(TRUE);
   SetSizer(sizerTop);
   sizerTop->SetSizeHints(this);
   sizerTop->Fit(this);

   RestoreTortoiseDialogSize(this, "ListEditors");
   SetTortoiseDialogPos(this, GetRemoteHandle());
   RestoreTortoiseDialogState(this, "ListEditors");
}
Ejemplo n.º 7
0
ConflictListDialog::ConflictListDialog(wxWindow* parent, 
                                       const std::vector<std::string>& files)
   : ExtDialog(parent, -1, _("TortoiseCVS - Resolve Conflicts"),
               wxDefaultPosition, wxDefaultSize,
               wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | 
               wxDEFAULT_DIALOG_STYLE | wxCLIP_CHILDREN)

{
   TDEBUG_ENTER("ConflictListDialog::ConflictListDialog");
   SetIcon(wxIcon(wxT("A_TORTOISE"), wxBITMAP_TYPE_ICO_RESOURCE));

   std::vector<ItemData*> itemData;
   std::vector<std::string> tmp;
   std::vector<std::string>::const_iterator it;

   // Add files
   it = files.begin();
   while (it != files.end())
   {
      ItemData *data = new ItemData();
      data->m_Filename = *it;
      data->m_Status = CVSStatus::STATUS_CONFLICT;
      itemData.push_back(data);
      tmp.push_back(*it);
      it++;
   }


   // Trim paths to sensible length
   ShortenPaths(tmp, myStub);

   wxStaticText* label2 = new ExtStaticText(this, -1, _(
"CVS encountered conflicts when trying to merge your changes in the files below. Please merge your changes manually."),
                                            wxDefaultPosition, 
                                            wxDLG_UNIT(this, wxSize(60, 15)));
   
   FilenameText* label1 = new FilenameText(this, -1, _("Folder: %s"), wxText(RemoveTrailingDelimiter(myStub)));
   label1->SetWindowStyle(label1->GetWindowStyle() | wxST_NO_AUTORESIZE);
   myFiles = new ExtListCtrl(this, CONFLICTLISTDLG_ID_FILES, wxDefaultPosition, wxDefaultSize, 
                             wxLC_REPORT | wxLC_ALIGN_LEFT);
   myFiles->PushEventHandler(new ListCtrlEventHandler(this));
   myFiles->InsertColumn(0, _("Filename"), wxLIST_FORMAT_LEFT, 0);
   myFiles->InsertColumn(1, _("Format"), wxLIST_FORMAT_LEFT, 0);
   myFiles->InsertColumn(2, _("Status"), wxLIST_FORMAT_LEFT, 0);
   AddFiles(tmp, itemData);
   myFiles->SetBestColumnWidth(0);
   myFiles->SetBestColumnWidth(1);
   myFiles->SetBestColumnWidth(2);
   myFiles->SetBestSize(wxDLG_UNIT(this, wxSize(150, 150)), wxDefaultSize);

   wxStaticText* tip = new wxStaticText(this, -1,
                                        _("To resolve the conflicts, double or right click on the files above."));
   tip->SetForegroundColour(SetForegroundColour(ColorRefToWxColour(GetIntegerPreference("Colour Tip Text"))));

   // OK/Cancel button
   wxBoxSizer* sizerConfirm = new wxBoxSizer(wxHORIZONTAL);
   myOK = new wxButton(this, wxID_OK, _("Close"));
   myOK->SetDefault();
   sizerConfirm->Add(myOK, 0, wxGROW | wxALL, 5);

   // Status bar
   myStatusBar = new wxStatusBar(this, -1);
   myStatusBar->SetStatusText(Printf(_("%d file(s)"), files.size()).c_str());

   // Main box with everything in it
   wxBoxSizer* sizerTop = new wxBoxSizer(wxVERTICAL);
   sizerTop->Add(label2, 0, wxGROW | wxALL, 3);
   sizerTop->Add(label1, 0, wxGROW | wxALL, 3);
   sizerTop->Add(myFiles, 2, wxGROW | wxALL, 3);
   sizerTop->Add(tip, 0, wxALIGN_LEFT | wxALL, 3);
   sizerTop->Add(sizerConfirm, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 10);
   sizerTop->Add(myStatusBar, 0, wxGROW | wxALL, 0);

   // Overall dialog layout settings
   SetAutoLayout(TRUE);
   SetSizer(sizerTop);
   sizerTop->SetSizeHints(this);
   sizerTop->Fit(this);

   RestoreTortoiseDialogSize(this, "Conflict");
   SetTortoiseDialogPos(this, GetRemoteHandle());
   RestoreTortoiseDialogState(this, "Conflict");
}