<commit_before>/*
    This file is part of KitchenSync.

    Copyright (c) 2005 <NAME> <<EMAIL>>

    This program is free 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 2 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
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#include <kapplication.h>
#include <kcolorscheme.h>
#include <kdialog.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kpassivepopup.h>
#include <kurllabel.h>

#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QPixmap>
#include <QtGui/QProgressBar>
#include <QtGui/QVBoxLayout>

#include <libqopensync/plugin.h>
#include <libqopensync/pluginenv.h>

#include "memberinfo.h"
#include "multiconflictdialog.h"
#include "singleconflictdialog.h"
#include "syncprocessmanager.h"

#include "groupitem.h"

GroupItem::GroupItem( KWidgetList *parent, SyncProcess *process )
  : KWidgetListItem( parent ), mSyncProcess( process ),
    mCallbackHandler( new QSync::CallbackHandler ),
    mProcessedItems( 0 ), mMaxProcessedItems( 0 ),
    mSynchronizing( false )
{
  QFont boldFont;
  boldFont.setBold( true );
  boldFont.setPointSize( boldFont.pointSize() + 2 );

  QGridLayout *layout = new QGridLayout( this );
  layout->setMargin( 1 );
  layout->setSpacing( 3 );

  mBox = new QWidget( this );
  mBoxLayout = new QVBoxLayout( mBox );
  mBoxLayout->setMargin( 1 );

  mProgressBar = new QProgressBar( this );
  mProgressBar->setRange( 0, 100 );

  mTime = new QLabel( this );
  mSyncAction = new KUrlLabel( "exec:/sync", i18n( "Synchronize Now" ), this );
  mConfigureAction = new KUrlLabel( "exec:/config", i18n( "Configure" ), this );

  // header
  QWidget *hbox = new QWidget( this );
  QHBoxLayout *hboxLayout = new QHBoxLayout( hbox );
  hboxLayout->setMargin( 2 );

  static QPixmap icon;
  if ( icon.isNull() ) {
    icon = KIconLoader::global()->loadIcon( "kontact_summary",
                                            KIconLoader::Desktop );
  }

  mIcon = new QLabel( hbox );
  mIcon->setPixmap( icon );
  mIcon->setFixedSize( mIcon->sizeHint() );
  hboxLayout->addWidget( mIcon );

  QPalette pal1;
  pal1.setColor( mIcon->backgroundRole(), palette().color( QPalette::Mid ) );
  mIcon->setPalette( pal1 );

  mGroupName = new QLabel( hbox );
  mGroupName->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
  mGroupName->setIndent( KDialog::spacingHint() );
  mGroupName->setFont( boldFont );
  mGroupName->setAutoFillBackground( true );
  hboxLayout->addWidget( mGroupName );

  QPalette pal2;
  pal2.setColor( mGroupName->foregroundRole(), palette().color( QPalette::Light ) );
  pal2.setColor( mGroupName->backgroundRole(), palette().color( QPalette::Mid ) );
  mGroupName->setPalette( pal2 );

  mStatus = new QLabel( hbox );
  mStatus->setAlignment( Qt::AlignRight | Qt::AlignVCenter );<commit_msg>Use existing icon<commit_after>/*
    This file is part of KitchenSync.

    Copyright (c) 2005 <NAME> <<EMAIL>>

    This program is free 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 2 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
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#include <kapplication.h>
#include <kcolorscheme.h>
#include <kdialog.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kpassivepopup.h>
#include <kurllabel.h>

#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QPixmap>
#include <QtGui/QProgressBar>
#include <QtGui/QVBoxLayout>

#include <libqopensync/plugin.h>
#include <libqopensync/pluginenv.h>

#include "memberinfo.h"
#include "multiconflictdialog.h"
#include "singleconflictdialog.h"
#include "syncprocessmanager.h"

#include "groupitem.h"

GroupItem::GroupItem( KWidgetList *parent, SyncProcess *process )
  : KWidgetListItem( parent ), mSyncProcess( process ),
    mCallbackHandler( new QSync::CallbackHandler ),
    mProcessedItems( 0 ), mMaxProcessedItems( 0 ),
    mSynchronizing( false )
{
  QFont boldFont;
  boldFont.setBold( true );
  boldFont.setPointSize( boldFont.pointSize() + 2 );

  QGridLayout *layout = new QGridLayout( this );
  layout->setMargin( 1 );
  layout->setSpacing( 3 );

  mBox = new QWidget( this );
  mBoxLayout = new QVBoxLayout( mBox );
  mBoxLayout->setMargin( 1 );

  mProgressBar = new QProgressBar( this );
  mProgressBar->setRange( 0, 100 );

  mTime = new QLabel( this );
  mSyncAction = new KUrlLabel( "exec:/sync", i18n( "Synchronize Now" ), this );
  mConfigureAction = new KUrlLabel( "exec:/config", i18n( "Configure" ), this );

  // header
  QWidget *hbox = new QWidget( this );
  QHBoxLayout *hboxLayout = new QHBoxLayout( hbox );
  hboxLayout->setMargin( 2 );

  static QPixmap icon;
  if ( icon.isNull() ) {
    icon = KIconLoader::global()->loadIcon( "document-multiple",
                                            KIconLoader::Desktop );
  }

  mIcon = new QLabel( hbox );
  mIcon->setPixmap( icon );
  mIcon->setFixedSize( mIcon->sizeHint() );
  hboxLayout->addWidget( mIcon );

  QPalette pal1;
  pal1.setColor( mIcon->backgroundRole(), palette().color( QPalette::Mid ) );
  mIcon->setPalette( pal1 );

  mGroupName = new QLabel( hbox );
  mGroupName->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
  mGroupName->setIndent( KDialog::spacingHint() );
  mGroupName->setFont( boldFont );
  mGroupName->setAutoFillBackground( true );
  hboxLayout->addWidget( mGroupName );

  QPalette pal2;
  pal2.setColor( mGroupName->foregroundRole(), palette().color( QPalette::Light ) );
  pal2.setColor( mGroupName->backgroundRole(), palette().color( QPalette::Mid ) );
  mGroupName->setPalette( pal2 );

  mStatus = new QLabel( hbox );
  mStatus->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
{'fraction_non_alphanumeric': 0.12030186445693992, 'fraction_numerical': 0.011245930748742231, 'mean_word_length': 4.104984894259819, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1528566', 'n_tokens_mistral': 2241, 'n_tokens_neox': 2134, 'n_words': 620}