summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog7
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp12
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp7
3 files changed, 16 insertions, 10 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index 608cd98..38756b1 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,23 +1,28 @@
12005-02-16 Dan Williams <drw@handhelds.org>
2
3 * Fixed stupid bug where last package in status file was not shown as installed when it should be
4 * Removed printf's
5
12005-01-02 Dan Williams <drw@handhelds.org> 62005-01-02 Dan Williams <drw@handhelds.org>
2 7
3 * Released version 0.6.1 8 * Released version 0.6.1
4 * Implemented native package linking code to remove need for ipkg-link 9 * Implemented native package linking code to remove need for ipkg-link
5 * Implement package in OIpkg (removed from InstallDlg) as this is ipkg specific 10 * Implement package in OIpkg (removed from InstallDlg) as this is ipkg specific
6 * Many small code tweaks 11 * Many small code tweaks
7 12
82004-12-21 Dan Williams <drw@handhelds.org> 132004-12-21 Dan Williams <drw@handhelds.org>
9 14
10 * Released version 0.6.0 15 * Released version 0.6.0
11 * Added support for Ipkg 'src/gz' feeds 16 * Added support for Ipkg 'src/gz' feeds
12 * Improve server and destination tabs UI's in configuration dialog 17 * Improve server and destination tabs UI's in configuration dialog
13 * Fix app linking to link all dependent packages as well as selected packages 18 * Fix app linking to link all dependent packages as well as selected packages
14 * Hide 'Retrive File List' button once list is retrieved in Package Info dialog 19 * Hide 'Retrive File List' button once list is retrieved in Package Info dialog
15 20
162004-11-18 Dan Williams <drw@handhelds.org> 212004-11-18 Dan Williams <drw@handhelds.org>
17 22
18 * Released version 0.5.0 23 * Released version 0.5.0
19 * All v1.0 functionality implemented 24 * All v1.0 functionality implemented
20 * Implemented installation of local packages 25 * Implemented installation of local packages
21 * Implemented linking of non-root apps (using ipkg-link) 26 * Implemented linking of non-root apps (using ipkg-link)
22 * Many UI tweaks for installation and filter dialogs 27 * Many UI tweaks for installation and filter dialogs
23 28
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index f2d7e39..e7e292e 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -350,32 +350,36 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString &
350 else if ( key.isEmpty() && value.isEmpty() ) 350 else if ( key.isEmpty() && value.isEmpty() )
351 newPackage = true; 351 newPackage = true;
352 352
353 // Skip past all description lines 353 // Skip past all description lines
354 if ( key == "Description" ) 354 if ( key == "Description" )
355 { 355 {
356 line = t.readLine(); 356 line = t.readLine();
357 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 357 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
358 line = t.readLine(); 358 line = t.readLine();
359 } 359 }
360 else 360 else
361 line = t.readLine(); 361 line = t.readLine();
362 } 362 }
363 363
364 f.close(); 364 f.close();
365 365
366 // Make sure to add to list last entry
367 if ( !name.isNull() && status.contains( " installed" ) )
368 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
369
366 return pl; 370 return pl;
367} 371}
368 372
369OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) 373OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name )
370{ 374{
371 // Find configuration item in list 375 // Find configuration item in list
372 OConfItemListIterator configIt( *m_confInfo ); 376 OConfItemListIterator configIt( *m_confInfo );
373 OConfItem *config = 0l; 377 OConfItem *config = 0l;
374 for ( ; configIt.current(); ++configIt ) 378 for ( ; configIt.current(); ++configIt )
375 { 379 {
376 config = configIt.current(); 380 config = configIt.current();
377 if ( config->type() == type && config->name() == name ) 381 if ( config->type() == type && config->name() == name )
378 break; 382 break;
379 } 383 }
380 384
381 if ( config && config->type() == type && config->name() == name ) 385 if ( config && config->type() == type && config->name() == name )
@@ -440,33 +444,33 @@ bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parame
440 break; 444 break;
441 case OPackage::Install : { 445 case OPackage::Install : {
442 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 446 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
443 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 447 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
444 { 448 {
445 ipkg_packages_install( &m_ipkgArgs, (*it) ); 449 ipkg_packages_install( &m_ipkgArgs, (*it) );
446 } 450 }
447 if ( destination != "root" ) 451 if ( destination != "root" )
448 linkPackageDir( destination ); 452 linkPackageDir( destination );
449 }; 453 };
450 break; 454 break;
451 case OPackage::Remove : { 455 case OPackage::Remove : {
452 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 456 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
453 457
454 // Get list of destinations for unlinking of packages not installed to root 458 // Get list of destinations for unlinking of packages not installed to root
455 OConfItemList *destList = destinations(); 459 OConfItemList *destList = destinations();
456 460
457 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 461 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
458 { 462 {
459 unlinkPackage( (*it), destList ); 463 unlinkPackage( (*it), destList );
460 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 464 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
461 } 465 }
462 466
463 delete destList; 467 delete destList;
464 }; 468 };
465 break; 469 break;
466 case OPackage::Download : { 470 case OPackage::Download : {
467 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 471 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
468 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 472 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
469 { 473 {
470 ipkg_packages_download( &m_ipkgArgs, (*it) ); 474 ipkg_packages_download( &m_ipkgArgs, (*it) );
471 } 475 }
472 }; 476 };
@@ -632,33 +636,33 @@ const QString &OIpkg::rootPath()
632 if ( m_rootPath.isEmpty() ) 636 if ( m_rootPath.isEmpty() )
633 { 637 {
634 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); 638 OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" );
635 rootDest ? m_rootPath = rootDest->value() 639 rootDest ? m_rootPath = rootDest->value()
636 : m_rootPath = '/'; 640 : m_rootPath = '/';
637 if ( m_rootPath.right( 1 ) == '/' ) 641 if ( m_rootPath.right( 1 ) == '/' )
638 m_rootPath.truncate( m_rootPath.length() - 1 ); 642 m_rootPath.truncate( m_rootPath.length() - 1 );
639 } 643 }
640 return m_rootPath; 644 return m_rootPath;
641} 645}
642 646
643void OIpkg::linkPackageDir( const QString &dest ) 647void OIpkg::linkPackageDir( const QString &dest )
644{ 648{
645 if ( !dest.isNull() ) 649 if ( !dest.isNull() )
646 { 650 {
647 OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); 651 OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest );
648 652
649 emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); 653 emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) );
650 654
651 // Set package destination directory 655 // Set package destination directory
652 QString destDir = destConfItem->value(); 656 QString destDir = destConfItem->value();
653 QString destInfoDir = destDir; 657 QString destInfoDir = destDir;
654 if ( destInfoDir.right( 1 ) != '/' ) 658 if ( destInfoDir.right( 1 ) != '/' )
655 destInfoDir.append( '/' ); 659 destInfoDir.append( '/' );
656 destInfoDir.append( IPKG_INFO_PATH ); 660 destInfoDir.append( IPKG_INFO_PATH );
657 661
658 // Get list of installed packages in destination 662 // Get list of installed packages in destination
659 QDir packageDir( destInfoDir ); 663 QDir packageDir( destInfoDir );
660 QStringList packageFiles; 664 QStringList packageFiles;
661 if ( packageDir.exists() ) 665 if ( packageDir.exists() )
662 { 666 {
663 packageDir.setNameFilter( "*.list" ); 667 packageDir.setNameFilter( "*.list" );
664 packageDir.setFilter( QDir::Files ); 668 packageDir.setFilter( QDir::Files );
@@ -676,33 +680,33 @@ void OIpkg::linkPackageDir( const QString &dest )
676 QFile packageFile( packageFileName ); 680 QFile packageFile( packageFileName );
677 if ( packageFile.open( IO_ReadOnly ) ) 681 if ( packageFile.open( IO_ReadOnly ) )
678 { 682 {
679 QTextStream t( &packageFile ); 683 QTextStream t( &packageFile );
680 QString linkFile; 684 QString linkFile;
681 while ( !t.eof() ) 685 while ( !t.eof() )
682 { 686 {
683 // Get the name of the file to link and build the sym link filename 687 // Get the name of the file to link and build the sym link filename
684 linkFile = t.readLine(); 688 linkFile = t.readLine();
685 QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) ); 689 QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) );
686 linkDest.prepend( rootPath() ); 690 linkDest.prepend( rootPath() );
687 691
688 // If file installed file is actually symbolic link, use actual file for linking 692 // If file installed file is actually symbolic link, use actual file for linking
689 QFileInfo fileInfo( linkFile ); 693 QFileInfo fileInfo( linkFile );
690 if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() ) 694 if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() )
691 linkFile = fileInfo.readLink(); 695 linkFile = fileInfo.readLink();
692 696
693 // See if directory exists in 'root', if not, create 697 // See if directory exists in 'root', if not, create
694 fileInfo.setFile( linkDest ); 698 fileInfo.setFile( linkDest );
695 QString linkDestDirName = fileInfo.dirPath( true ); 699 QString linkDestDirName = fileInfo.dirPath( true );
696 QDir linkDestDir( linkDestDirName ); 700 QDir linkDestDir( linkDestDirName );
697 if ( !linkDestDir.exists() ) 701 if ( !linkDestDir.exists() )
698 { 702 {
699 linkDestDir.mkdir( linkDestDirName ); 703 linkDestDir.mkdir( linkDestDirName );
700 } 704 }
701 else 705 else
702 { 706 {
703 // Remove any previous link to make sure we will be pointing to the current version 707 // Remove any previous link to make sure we will be pointing to the current version
704 if ( QFile::exists( linkDest ) ) 708 if ( QFile::exists( linkDest ) )
705 QFile::remove( linkDest ); 709 QFile::remove( linkDest );
706 } 710 }
707 711
708 // Link the file 712 // Link the file
@@ -720,33 +724,33 @@ void OIpkg::linkPackageDir( const QString &dest )
720 724
721void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList ) 725void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList )
722{ 726{
723 if ( !package.isNull() ) 727 if ( !package.isNull() )
724 { 728 {
725 // Find destination package is installed in 729 // Find destination package is installed in
726 if ( destList ) 730 if ( destList )
727 { 731 {
728 OConfItemListIterator it( *destList ); 732 OConfItemListIterator it( *destList );
729 for ( ; it.current(); ++it ) 733 for ( ; it.current(); ++it )
730 { 734 {
731 OConfItem *dest = it.current(); 735 OConfItem *dest = it.current();
732 QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() ) 736 QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() )
733 .arg( IPKG_INFO_PATH ) 737 .arg( IPKG_INFO_PATH )
734 .arg( package ); 738 .arg( package );
735 //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) ); 739 //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) );
736 740
737 // If found and destination is not 'root', remove symbolic links 741 // If found and destination is not 'root', remove symbolic links
738 if ( QFile::exists( destInfoFileName ) && dest->name() != "root" ) 742 if ( QFile::exists( destInfoFileName ) && dest->name() != "root" )
739 { 743 {
740 QFile destInfoFile( destInfoFileName ); 744 QFile destInfoFile( destInfoFileName );
741 if ( destInfoFile.open( IO_ReadOnly ) ) 745 if ( destInfoFile.open( IO_ReadOnly ) )
742 { 746 {
743 QTextStream t( &destInfoFile ); 747 QTextStream t( &destInfoFile );
744 QString linkFile; 748 QString linkFile;
745 while ( !t.eof() ) 749 while ( !t.eof() )
746 { 750 {
747 // Get the name of the file to link and build the sym link filename 751 // Get the name of the file to link and build the sym link filename
748 linkFile = t.readLine(); 752 linkFile = t.readLine();
749 QString linkDest( linkFile.right( linkFile.length() - 753 QString linkDest( linkFile.right( linkFile.length() -
750 dest->value().length() ) ); 754 dest->value().length() ) );
751 linkDest.prepend( rootPath() ); 755 linkDest.prepend( rootPath() );
752 756
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index ac16954..c9fdec1 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -70,36 +70,35 @@ void OPackageManager::loadAvailablePackages()
70 // Update status 70 // Update status
71 QString status = tr( "Reading available packages:\n\t" ); 71 QString status = tr( "Reading available packages:\n\t" );
72 status.append( server->name() ); 72 status.append( server->name() );
73 emit statusText( status ); 73 emit statusText( status );
74 ++serverCount; 74 ++serverCount;
75 emit statusBar( serverCount ); 75 emit statusBar( serverCount );
76 qApp->processEvents(); 76 qApp->processEvents();
77 77
78 OPackageList *packageList = m_ipkg.availablePackages( server->name() ); 78 OPackageList *packageList = m_ipkg.availablePackages( server->name() );
79 if ( packageList ) 79 if ( packageList )
80 { 80 {
81 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 81 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
82 { 82 {
83 OPackage *package = packageIt.current(); 83 OPackage *package = packageIt.current();
84 84
85 // Load package info 85 // Load package info
86 if ( !m_packages.find( package->name() ) ) { 86 if ( !m_packages.find( package->name() ) )
87 printf( "ADD AVAILABLE '%s'\n", package->name().latin1());
88 m_packages.insert( package->name(), package ); 87 m_packages.insert( package->name(), package );
89 } else 88 else
90 { 89 {
91 // If new package is newer version, replace existing package 90 // If new package is newer version, replace existing package
92 OPackage *currPackage = m_packages[package->name()]; 91 OPackage *currPackage = m_packages[package->name()];
93 if ( compareVersions( package->version(), currPackage->version() ) == 1 ) 92 if ( compareVersions( package->version(), currPackage->version() ) == 1 )
94 m_packages.replace( package->name(), package ); 93 m_packages.replace( package->name(), package );
95 } 94 }
96 95
97 // Add category to list if it doesn't already exist 96 // Add category to list if it doesn't already exist
98 if ( m_categories.grep( package->category() ).isEmpty() ) 97 if ( m_categories.grep( package->category() ).isEmpty() )
99 { 98 {
100 m_categories << package->category(); 99 m_categories << package->category();
101 categoryAdded = true; 100 categoryAdded = true;
102 } 101 }
103 } 102 }
104 } 103 }
105 } 104 }
@@ -126,53 +125,51 @@ void OPackageManager::loadInstalledPackages()
126 125
127 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 126 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
128 { 127 {
129 OConfItem *destination = destIt.current(); 128 OConfItem *destination = destIt.current();
130 129
131 // Process destination only if it is active 130 // Process destination only if it is active
132 if ( destination->active() ) 131 if ( destination->active() )
133 { 132 {
134 // Update status 133 // Update status
135 QString status = tr( "Reading installed packages:\n\t" ); 134 QString status = tr( "Reading installed packages:\n\t" );
136 status.append( destination->name() ); 135 status.append( destination->name() );
137 emit statusText( status ); 136 emit statusText( status );
138 ++destCount; 137 ++destCount;
139 emit statusBar( destCount ); 138 emit statusBar( destCount );
140 qApp->processEvents(); 139 qApp->processEvents();
141 140
142 printf( "DESGTINATION %s\n", destination->name().latin1());
143 OPackageList *packageList = m_ipkg.installedPackages( destination->name(), 141 OPackageList *packageList = m_ipkg.installedPackages( destination->name(),
144 destination->value() ); 142 destination->value() );
145 if ( packageList ) 143 if ( packageList )
146 { 144 {
147 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 145 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
148 { 146 {
149 OPackage *package = packageIt.current(); 147 OPackage *package = packageIt.current();
150 OPackage *currPackage = m_packages[package->name()]; 148 OPackage *currPackage = m_packages[package->name()];
151 if ( currPackage ) 149 if ( currPackage )
152 { 150 {
153 // Package is in a current feed, update installed version, destination 151 // Package is in a current feed, update installed version, destination
154 currPackage->setVersionInstalled( package->versionInstalled() ); 152 currPackage->setVersionInstalled( package->versionInstalled() );
155 currPackage->setDestination( package->destination() ); 153 currPackage->setDestination( package->destination() );
156 154
157 delete package; 155 delete package;
158 } 156 }
159 else 157 else
160 { 158 {
161 // Package isn't in a current feed, add to list 159 // Package isn't in a current feed, add to list
162 printf( "ADD INSTALLED '%s'\n", package->name().latin1());
163 m_packages.insert( package->name(), package ); 160 m_packages.insert( package->name(), package );
164 161
165 // Add category to list if it doesn't already exist 162 // Add category to list if it doesn't already exist
166 if ( m_categories.grep( package->category() ).isEmpty() ) 163 if ( m_categories.grep( package->category() ).isEmpty() )
167 { 164 {
168 m_categories << package->category(); 165 m_categories << package->category();
169 categoryAdded = true; 166 categoryAdded = true;
170 } 167 }
171 } 168 }
172 } 169 }
173 } 170 }
174 } 171 }
175 } 172 }
176 delete destList; 173 delete destList;
177 174
178 // Sort category list if categories were added 175 // Sort category list if categories were added