<commit_before>/*  This file is part of the KDE KMobile library
    Copyright (C) 2003 <NAME> <<EMAIL>>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License version 2 as published by the Free Software Foundation.

    This library 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 GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.

*/

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>

#include <qstring.h>
#include <qstringlist.h>
#include <qfile.h>

#include <klibloader.h>
#include <kstandarddirs.h>
#include "kmobiledevice.h"
#include <kmessagebox.h>
#include <kconfig.h>

#include <kio/global.h>
#include <kdebug.h>
#include <klocale.h>

#define KMOBILEDEVICE_DEBUG_AREA 5730
#define PRINT_DEBUG kdDebug(KMOBILEDEVICE_DEBUG_AREA) << "KMobileDevice: "

/**
 *  The base plugin class of all mobile device drivers.
 */

KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &args)
	: KLibFactory(obj,name),
           m_config(0L), d(0L)
{
  setClassType(Unclassified);
  setCapabilities(hasNothing);
  m_deviceName = i18n("Unknown Device");
  m_deviceRevision = i18n("n/a");  /* not available */
  m_connectionName = i18n("Unknown Connection");

  // set the config file name
  m_configFileName = args[0];
  if (m_configFileName.isEmpty())
	m_config = new KConfig();
  else
	m_config = new KConfig(m_configFileName);
  PRINT_DEBUG << QString("name of config file is %1\n").arg(m_configFileName);
}

KMobileDevice::~KMobileDevice()
{
  delete m_config;
}


bool KMobileDevice::connected()
{
  return m_connected;
}

// returns e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
QString KMobileDevice::deviceClassName() const
{
  return m_deviceClassName;
}

// returns real device name, e.g. "Nokia 6310" or "Rio MP3 Player"
QString KMobileDevice::deviceName() const
{
  return m_deviceName;
}

QString KMobileDevice::revision() const
{
  return m_deviceRevision;
}

bool KMobileDevice::isSlowDevice() const
{
  return false;
}

bool KMobileDevice::isReadOnly() const
{
  return false;
}

bool KMobileDevice::configDialog( QWidget *parent )
{
  KMessageBox::information( parent,
		i18n("This device does not need any configuration."),
		deviceName() );
  return true;
}

void KMobileDevice::setClassType( enum ClassType ct )
{
  m_classType = ct;
  m_deviceClassName = defaultClassName(ct);
};

enum KMobileDevice::ClassType KMobileDevice::classType() const
{
  return m_classType;
};

QString KMobileDevice::iconFileName() const
{
  return defaultIconFileName( classType() );
}

QString KMobileDevice::defaultIconFileName( ClassType ct )
{
  QString name;
  switch (ct) {
    case Phone:		name = "mobile_phone";		break;
    case Organizer:	name = "mobile_organizer";	break;
    case Camera:	name = "mobile_camera";		break;
    case MusicPlayer:	name = "mobile_mp3player";	break;
    case Unclassified:
    default:		name = KMOBILE_ICON_UNKNOWN;	break;
  }
  return name;
}

QString KMobileDevice::defaultClassName( ClassType ct )
{
  QString name;
  switch (ct) {
    case Phone:		name = i18n("Cellular Mobile Phone");	break;
    case Organizer:	name = i18n("Organizer");		break;
    case Camera:	name = i18n("Digital Camera");		break;
    case MusicPlayer:	name = i18n("Music/MP3 Player");	break;
    case Unclassified:
    default:		name = i18n("Unclassified Device");	break;
  }
  return name;
}

void KMobileDevice::setCapabilities( int caps )
{
  m_caps = caps;
};

int KMobileDevice::capabilities() const
{
  return m_caps;
};

const QString KMobileDevice::nameForCap(int cap) const
{
  switch (cap) {<commit_msg>Fix comma<commit_after>/*  This file is part of the KDE KMobile library
    Copyright (C) 2003 <NAME> <<EMAIL>>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License version 2 as published by the Free Software Foundation.

    This library 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 GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.

*/

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>

#include <qstring.h>
#include <qstringlist.h>
#include <qfile.h>

#include <klibloader.h>
#include <kstandarddirs.h>
#include "kmobiledevice.h"
#include <kmessagebox.h>
#include <kconfig.h>

#include <kio/global.h>
#include <kdebug.h>
#include <klocale.h>

#define KMOBILEDEVICE_DEBUG_AREA 5730
#define PRINT_DEBUG kdDebug(KMOBILEDEVICE_DEBUG_AREA) << "KMobileDevice: "

/**
 *  The base plugin class of all mobile device drivers.
 */

KMobileDevice::KMobileDevice(QObject *obj, const char *name, const QStringList &args)
	: KLibFactory(obj,name),
           m_config(0L), d(0L)
{
  setClassType(Unclassified);
  setCapabilities(hasNothing);
  m_deviceName = i18n("Unknown Device");
  m_deviceRevision = i18n("n/a");  /* not available */
  m_connectionName = i18n("Unknown Connection");

  // set the config file name
  m_configFileName = args[0];
  if (m_configFileName.isEmpty())
	m_config = new KConfig();
  else
	m_config = new KConfig(m_configFileName);
  PRINT_DEBUG << QString("name of config file is %1\n").arg(m_configFileName);
}

KMobileDevice::~KMobileDevice()
{
  delete m_config;
}


bool KMobileDevice::connected()
{
  return m_connected;
}

// returns e.g. "Nokia mobile phone", "MP3 Player", "Handspring Organizer"
QString KMobileDevice::deviceClassName() const
{
  return m_deviceClassName;
}

// returns real device name, e.g. "Nokia 6310" or "Rio MP3 Player"
QString KMobileDevice::deviceName() const
{
  return m_deviceName;
}

QString KMobileDevice::revision() const
{
  return m_deviceRevision;
}

bool KMobileDevice::isSlowDevice() const
{
  return false;
}

bool KMobileDevice::isReadOnly() const
{
  return false;
}

bool KMobileDevice::configDialog( QWidget *parent )
{
  KMessageBox::information( parent,
		i18n("This device does not need any configuration."),
		deviceName() );
  return true;
}

void KMobileDevice::setClassType( enum ClassType ct )
{
  m_classType = ct;
  m_deviceClassName = defaultClassName(ct);
}

enum KMobileDevice::ClassType KMobileDevice::classType() const
{
  return m_classType;
}

QString KMobileDevice::iconFileName() const
{
  return defaultIconFileName( classType() );
}

QString KMobileDevice::defaultIconFileName( ClassType ct )
{
  QString name;
  switch (ct) {
    case Phone:		name = "mobile_phone";		break;
    case Organizer:	name = "mobile_organizer";	break;
    case Camera:	name = "mobile_camera";		break;
    case MusicPlayer:	name = "mobile_mp3player";	break;
    case Unclassified:
    default:		name = KMOBILE_ICON_UNKNOWN;	break;
  }
  return name;
}

QString KMobileDevice::defaultClassName( ClassType ct )
{
  QString name;
  switch (ct) {
    case Phone:		name = i18n("Cellular Mobile Phone");	break;
    case Organizer:	name = i18n("Organizer");		break;
    case Camera:	name = i18n("Digital Camera");		break;
    case MusicPlayer:	name = i18n("Music/MP3 Player");	break;
    case Unclassified:
    default:		name = i18n("Unclassified Device");	break;
  }
  return name;
}

void KMobileDevice::setCapabilities( int caps )
{
  m_caps = caps;
}

int KMobileDevice::capabilities() const
{
  return m_caps;
}

const QString KMobileDevice::nameForCap(int cap) const
{
  switch (cap) {
{'fraction_non_alphanumeric': 0.10998796630565584, 'fraction_numerical': 0.012755716004813478, 'mean_word_length': 4.410807291666667, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4479691', 'n_tokens_mistral': 2835, 'n_tokens_neox': 2749, 'n_words': 817}